function refresh(h)
%REFRESH Refresh figure.
%   REFRESH causes the current figure window to be redrawn. 
%   REFRESH(FIG) causes the figure FIG to be redrawn.

%   D. Thomas   5/26/93
%   Copyright 1984-2002 The MathWorks, Inc. 
%   $Revision: 5.11.4.1 $  $Date: 2004/10/22 19:44:18 $

if nargin==1,
    objtype = '';
    try 
        % don't need a catch, we just want to know if this is a figure
        objtype = get(h,'type');
    catch
        if ~isempty(findstr(lasterr,'Invalid handle'))
            rethrow(lasterror)
        end
    end
    
    if ~strcmp(objtype,'figure'),
        error('Handle does not refer to a figure object')
    end
else,
    h = gcf;
end

color = get(h,'color');
if ~isstr(color) & color == [0 0 0]
    tmpcolor = [1 1 1];
else
    tmpcolor = [0 0 0];
end
set(h,'color',tmpcolor,'color',color);
