why set sentence appears just when run step by step ?

1 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2021-8-19
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.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2021-8-19
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()

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by