How can i display a variable in the figure

how can i display in a figure a variable..
something like:
your score is %d, score
when score can get different values.
Thanks

Réponses (3)

Adam
Adam le 23 Nov 2014
Use a uicontrol with 'Style' 'text' and set the 'String' property to num2str( variableName ).
doc uicontrol
Hanna Buitenhuis
Hanna Buitenhuis le 16 Oct 2018

1 vote

Hi! this worked for mine as well but it displays it right after the click. How can I make it that it displays at the end of a game I made?

1 commentaire

Image Analyst
Image Analyst le 16 Oct 2018
What worked? Whose post should your "Answer" have been a comment to: me, Adam, or oMRi? Plus, even if it were for me, I have no idea how to answer. Just put the code at the end of your game code.

Connectez-vous pour commenter.

Image Analyst
Image Analyst le 23 Nov 2014
message = sprintf('Your score is %d.', score);
uiwait(helpdlg(message));

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Tags

Question posée :

le 23 Nov 2014

Commenté :

le 16 Oct 2018

Community Treasure Hunt

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

Start Hunting!

Translated by