Effacer les filtres
Effacer les filtres

why set sentence appears just when run step by step ?

1 vue (au cours des 30 derniers jours)
Rana Muayad
Rana Muayad le 17 Août 2021
Commenté : Walter Roberson le 19 Août 2021
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 commentaires
Rana Muayad
Rana Muayad le 19 Août 2021
it's part of code not full code
Walter Roberson
Walter Roberson le 19 Août 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.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 19 Août 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()

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by