How can i display a variable in the figure

7 views (last 30 days)
oMRi bono
oMRi bono on 23 Nov 2014
Commented: Image Analyst on 16 Oct 2018
how can i display in a figure a variable..
something like:
your score is %d, score
when score can get different values.
Thanks

Answers (3)

Adam
Adam on 23 Nov 2014
Use a uicontrol with 'Style' 'text' and set the 'String' property to num2str( variableName ).
doc uicontrol

Hanna Buitenhuis
Hanna Buitenhuis on 16 Oct 2018
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 Comment
Image Analyst
Image Analyst on 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.

Sign in to comment.


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

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!