MATLAB: How to put a waitbar in an existing figure in MATLAB 7.13 (R2011b) MATLAB I would like to put a waitbar in an existing figure, such as a GUI figure, instead of having it appear in a separate window. Best Answer There is no single command for placing a WAITBAR inside an existing GUI or figure.As a workaround, one can construct a wait bar from axes and rectangle objects. Please see the following functions for an example.function waitbar_init(h_axes)%h_axes is an axes handledelete(get(h_axes,'Children'));axis(h_axes,[0 1 0 1]);axis(h_axes,'off');rectangle('Position',[0 0 1 1],'Parent',h_axes,'FaceColor','w','EdgeColor','k');function waitbar_fill(h_axes,fill)c = get(h_axes,'Children');if length(c) == 2 if fill > 0 set(c(1),'Position',[0 0 fill 1]); elseif fill == 0 delete(c(1)); endelseif fill > 0 rectangle('Position',[0 0 fill 1],'Parent',h_axes,'FaceColor','r','EdgeColor','k');end Related SolutionsMATLAB: How to control whether or not a figure window is hidden or visible in MATLAB 7.7 (R2008b) To do this, toggle the 'Visible' Figure property as shown in the following code:h = figure(1);pauseset(h,'Visible','off') %makes the figure invisiblepauseset(h,'Visible','on') %makes the figure visible again MATLAB: How to place an annotation one level deeper I'm not aware of a way to order the layers. I think my approach would probably be to add a black shape in the image under the annotation. The annotation will move if the figure is resized.% Add black shape in specified locationbx = mapshape([3541660 3541900 3541900 3541660],[5492180 5492180 5492250 5492250],'Geometry','polygon');mapshow(ax,bx,'FaceColor','k') Related QuestionImage invisibleHow to use the waitbar on the figure with MATLAB 2014bHow to Execute Something When a Graphics Object is Left-ClickedHow to determine the axes within a figure to which the colorbar corresponds in MATLABHow to customize the figure menubar in MATLAB 7.4 (R2007a)
Best Answer