function h = DisplayProgressBar(varargin)
try
if ishandle(varargin{1})
ax = varargin{1};
value = varargin{2};
p = get(ax,'Child');
x = get(p,'XData');
x(3:4) = value;
set(p,'XData',x)
return
end
pos = varargin{1};
backgroundColor = [249, 158, 0] / 255;
foregroundColor = [0 .5 0];
h = axes('Units','normalized',...
'Position',pos,...
'XLim',[0 1],'YLim',[0 1],...
'XTick',[],'YTick',[],...
'Color', backgroundColor,...
'XColor', backgroundColor,'YColor', backgroundColor);
patch([0 0 0 0], [0 1 1 0], foregroundColor,...
'Parent', h,...
'EdgeColor', 'none');
catch ME
message = sprintf('Error in DisplayProgressBar():\n%s', ME.message);
WarnUser(message);
end
return;