Effacer les filtres
Effacer les filtres

Change message in static text in a gui -loop

4 vues (au cours des 30 derniers jours)
Inês Mendes
Inês Mendes le 7 Juil 2015
Commenté : Image Analyst le 8 Juil 2015
Hi guys,
I am having some trouble changing a static text in a gui. I have a loop and a message that changes along that loop.
I want the message in the static text to change with it.
I have tried using set() but it isn't working...
For example:
If x=2
d='True';
else
d='False';
end
set(handles.statictext,'String',d);
Can anyone help?
Thanks in advance!
Inês

Réponse acceptée

Image Analyst
Image Analyst le 7 Juil 2015
Use double equals and not equals. Also use if not If, and use drawnow. Try it like this:
if x==2 % Use == not =
d='True';
else
d='False';
end
set(handles.statictext,'String',d);
drawnow; % Force immediate update.
  2 commentaires
Inês Mendes
Inês Mendes le 7 Juil 2015
i don´t know why it´s not working...
it still appears an error : attemp to reference field of non-structure array
Image Analyst
Image Analyst le 8 Juil 2015
You probably did not give the "tag" property of your static text label. Put
handles
right before the set() call, and see what values it lists for handles. Your static text label should be one of the names listed.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by