why set sentence appears just when run step by step ?
1 view (last 30 days)
Show older comments
hi,
I have a program in the graphical interface of Matlab that has 3 push buttons, each one performs a specific task, but all of them start writing a static text sentence using set command. When executing, the first button appears, but when the other two buttons are executed, the sentence does not appear, it appears only when executing step by step. What is the reason for that?
5 Comments
Walter Roberson
on 19 Aug 2021
It would be... unusual... for someone to abbreviate full code that does not use global variables, as code that does use global variables when they post asking for advice... except possibly for cases where the poster was supplying a (semi-) working example with the global variables acting to "stub out" the rest of the program.
But the posted code was not a working example, so the only self-consistent explanation is that the full code uses global variables as well. And in that case, Rik's question of why global variables are being used is still relevant.
Answers (1)
Walter Roberson
on 19 Aug 2021
Screen updates are made under the following circumstances:
- figure() is called to activate an existing figure
- figure() is called to create a new figure
- drawnow() is executed
- pause() is executed
- uiwait() or waitfor() are called (uiwait() calls waitfor())
- program returns to keyboard execution, such as if execution finishes, or a breakpoint is reached, or the program uses keyboard()
Your code is not doing anything to request an update after changing the graphics properties, so the change to the visible display will wait until... whenever it happens.
When you need a screen update, call drawnow()
0 Comments
See Also
Categories
Find more on Interactive Control and Callbacks 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!