Waitbar message disappears and can't be updated (GUI)
6 views (last 30 days)
Show older comments
I am working on a GUI which analyzes data using quite lengthy calculations. I am trying to implement waitbars to show the progression of serveral different processes that the GUI performs. However, in the case of one of those processes, my waitbar progresses, but the message just above it disappears when I first update the bar. If I try to include the message in subsequent waitbar calls (waitbar(x,h,'updated message')), Matlab returns an error ('Improper arguments for waitbar').
I won't include code here since the calls to this waitbar span several functions. In brief, I first call and create the waitbar in a callback function of my main interface m file (it activates after the user presses on a button which triggers a calculation). Afterwards, I update the waitbar in several 'for loops' contained in seperate functions that the callback function inside the main interface calls. I made the handle of the waitbar global so I could call it inside my different functions, and I specify the handle every time I update the waitbar. The message still does not display after the first call, though.
What could be causing this? Is it possible to use a waitbar to monitor the progress of a process that spans several functions?
3 Comments
Answers (1)
Walter Roberson
on 23 Jun 2015
something is destroying the waitbar()
A waitbar is a figure. I suggest you attach a UserData to it that is an OnCleanup object that displays the call stack at the time of the destruction.
h = waitbar(....);
set(h, 'UserData', onCleanup(@() dbstack('-completenames')));
7 Comments
Stephen23
on 27 Jun 2015
Edited: Stephen23
on 27 Jun 2015
What version of MATLAB are you using? This behavior may be related to a specific version...
At this point it might be worth using MATLAB's debugging tools and set a break-point to track down when this error occurs. Then check exactly what is happening when this error occurs, what value/s the associated variable have, and if the waitbar figure and text handles are correct.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!