cancelling waitbar insdie a gui function
Show older comments
Hello everyone, I am having some problem with waitbar defined inside a gui script. The problem is I have created a waitbar with cancel option which was working fine outside. But when I pasted it inside my gui.m script the cancel button is not working (rest all is fine). Below is the code I have used:
pvh=waitbar(0,'calculating.....','name','ESTIMATION',...
'createcancelbtn','setappdata(pvh,''cancel_callback'',1)');
setappdata(pvh,'cancel_callback',0);
for count_i1 = 1:l_count
if getappdata(pvh,'cancel_callback')==1
errordlg('Stopped by user');
break;
end
waitbar(count_i1/ l_count,pvh,sprintf('Calculating %d %s %d',count_i1,'of', l_count))
I went through some help of MATLAB and tried some options like drawnow or updating the handles of the waitbar figure. Looks like I did not do it properly. Any suggestions on how to make it work? thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!