I have done a lot of research on this and cannot seem to find a solution that is what I am looking for... maybe because what I am trying to do just isn't possible in Matlab, but I am sure there is a way. I have an app that I am designing in App designer that is in the barebones stages right now... I want to implement a wait bar of some sort into the app along with the other components, i.e. not in a separate figure. Alot of what I have found has been using the waitbar function to open another figure with the waitbar, and I currently am using that right now, but want to get the waitbar inside my app. I may not be able to use the matlab built in waitbar, and have already tried looking through the code but was not able to replicate the creation of it inside the app. I know there are many options on the file exchange, but again, nothing that seems to be what I am looking for. Does anyone know of a way, or can guide me in the right direction as to how I can approach this? Just imagine opening app designer, adding in a button or slider or whatever, and then adding in a waitbar to that same figure, that can update by pressing the button for example. Hopefully someone has come up with a good solution for this by now and can help me out! Open to all suggestions.
Kshitij Singh answered .
2025-11-20
% Set up the progress bar axis
fh = clf();
ax = axes(fh,'Position',[.1 .4 .8 .05],'box','on','xtick',[],'ytick',[],...
'color',[0.9375 0.9375 0.9375],'xlim',[0,1],'ylim',[0,1]); %gray94
title(ax,'Progress')
% Create empty patch that will be updated
ph = patch(ax,[0 0 0 0],[0 0 1 1],[0.67578 1 0.18359]); %greenyellow
% Create the percent-complete text that will be updated
th = text(ax,1,1,'0%','VerticalAlignment','bottom','HorizontalAlignment','right');
% Create processing loop that updates the progress bar
n = 100;
for i = 1:n
% update patch size and percentage text
ph.XData = [0 i/n i/n 0];
th.String = sprintf('%.0f%%',round(i/n*100));
drawnow %update graphics
end
