Stuart’s MATLAB Videos

Watch and Learn

MATLAB Basics: Change the string on a button when pushed 2

Posted by Doug Hull,

January t-shirt winner will be announced on Friday. There is no survey for this video, but you can still get in on last week’s survey to win a MATLAB t-shirt. This two and a quarter minute video shows how to change the string on a button when pushed. Similar techniques can be used for lots of different GUI actions.

2 CommentsOldest to Newest

Keith replied on : 1 of 2
Hi Doug, I've been looking through your excellent GUIDE tutorials and trying to find the answer to what I feel like is probably a really dumb question. I have a function in my gui that does all the real work/number crunching of my program. What I would like to do is to have an indicator that tells the user that the program is actually executing and alerts him when the new results have been computed. Right now I'm trying to do this with just a non-editable text box. When my RunSimulation() function starts, the first thing I do is:
set(handles.StatusBar, 'String', 'Calculating...');
guidata(handles.StatusBar, handles);
and the last thing I do in the function (after all the computation is complete) is:
set(handles.StatusBar, 'String', 'Ready.');
guidata(handles.StatusBar, handles);
What happens though is that the StatusBar only ever says "Ready." In the matlab window, though, it prints out stuff that confirms that something is actually going on inside the program. I guess my question is: when do the contents of the various UI elements actually get updated and/or how can I force particular elements to change immediately when I set new contents? Thanks, Keith