Waitbar message disappears and can't be updated (GUI)

6 views (last 30 days)
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
Walter Roberson
Walter Roberson on 24 Jun 2015
Or "clear all" ! That one messes up your whole program.
Rosalie Martel
Rosalie Martel on 25 Jun 2015
There is no 'close all' or 'clear all' in my program, except at the beginning. There is none in the span of code covered by the waitbar.

Sign in to comment.

Answers (1)

Walter Roberson
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
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.
Rosalie Martel
Rosalie Martel on 30 Jun 2015
I am using R2014b. I will see what I can find using the debugger.

Sign in to comment.

Categories

Find more on App Building in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!