下面的代码将允许您添加垂直线到您的waitbar http://www.mathworks.com/help/techdoc/ref/waitbar.html:
hWait = waitbar(0,'Progress'); %# Create the waitbar and return its handle
hAxes = get(hWait,'Children'); %# Get the axes object of the waitbar figure
xLimit = get(hAxes,'XLim'); %# Get the x-axis limits
yLimit = get(hAxes,'YLim'); %# Get the y-axis limits
xData = repmat(linspace(xLimit(1),xLimit(2),11),2,1); %# X data for lines
yData = repmat(yLimit(:),1,11); %# Y data for lines
hLine = line(xData,yData,'Parent',hAxes,... %# Plot the lines on the axes...
'Color','k',... %# ... in black...
'HandleVisibility','off'); %# ... and hide the handles
运行上面的代码然后执行waitbar(0.35,hWait);
,你会看到这样的图:
NOTE:图中的黑线(我添加的两条垂直线and进度条周围已存在的框)将在更新时间歇性地出现在红色进度条的上方或下方。这似乎是一个现有的错误WAITBAR http://www.mathworks.com/help/techdoc/ref/waitbar.html行为,我还没有找到解决方法来纠正它。不过,可以在网上找到很多替代方案MathWorks 文件交换 http://www.mathworks.com/matlabcentral/fileexchange/?term=progress%20bar,所以如果内置函数不能为你做这件事,我当然会检查一下。 ;)