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

Answers (3)

Use a uicontrol with 'Style' 'text' and set the 'String' property to num2str( variableName ).
doc uicontrol
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

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.

message = sprintf('Your score is %d.', score);
uiwait(helpdlg(message));

Categories

Find more on App Building in Help Center and File Exchange

Tags

Asked:

on 23 Nov 2014

Commented:

on 16 Oct 2018

Community Treasure Hunt

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

Start Hunting!