How to reset the static text box each time i press the run button

Hey so I have a static text box that after my code has run (after I push the run button) displays "DONE". I want the displayed message to revert back to "-" after I press the run button again so that it is clear when the code is done running. I've been using
pause(4)
then
set(handles.editbox1,'string','-');
to reset it after 4 seconds, but this is not helpful if you leave come back and the result is still the same (i.e. can't tell that it ran).

Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 29 Aug. 2013

0 Stimmen

Where did you put those 3 lines of code? Maybe they are in the static text callback which is wrong

3 Kommentare

at the end of my run button.
What do you mean by: if you leave come back
it takes a while to run. like physically get up and then come back to your computer

Melden Sie sich an, um zu kommentieren.

Image Analyst
Image Analyst am 29 Aug. 2013

0 Stimmen

Then the only way is to either leave it as "Done", or put up a messagebox to tell the user, because your program that set the label to "Done" and then sets it to "-" 4 seconds later can't possibly know when your user returns to the computer. With either of those ways, the user will know your code has finished. They might also surmise that it's finished if you set it to "-" if, when it's running, you have the info text label say "processing...." while it's running or put up a progress bar. If they don't see "processing..." or the progress bar, and instead see the "-" or "Done" or message box, then they'll figure that it's done. Anything wrong with that?

3 Kommentare

it stays "DONE" even when you hit run again. so "DONE" never changes and if it reverts to "-" after 4 seconds it will stay "-" unless you sit there (long time to wait) and see the "DONE" appear and then revert to "-". otherwise you will always see "-". I just want some help making the static text revert to "-" every time I press the run button.
making the same static text box show "processing" doesn't work either.
order of process:
set(handles.text,'string','processing')
call to function
set(handles.text,'string','DONE')
pause(4)
set(handles.text,'string','-')
after this has ran, '-' is the only thing displayed even after I press the run button again. also I have no clue how to add the progress bar because my function uses fminsearch of a loop. so there is nowhere to put the iterations in to make the bar progress.
Sometimes it gets into a function so intensive that the message to update the label doesn't get executed until much later. Try putting a "drawnow" after every call to set(). That should force the update to happen, so that when you press the button again it will show the "processing" string.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 29 Aug. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by