How to make my output display in static box(GUI)
7 views (last 30 days)
Show older comments
my output is currently printing out in the command window, i would like to display in the static text box
0 Comments
Answers (1)
Voss
on 12 Apr 2022
% First, create your static text box somewhere:
t = uicontrol('Style','text');
% Later, when you have something to show in it, show it:
set(t,'String','Something to Show');
2 Comments
Voss
on 12 Apr 2022
Edited: Voss
on 12 Apr 2022
If you have the handle of your static text box (here, it is the variable t), say because it was created like this:
t = uicontrol('Style','text','Tag','mm');
Then you can do this:
outvec = [1 2 3 4 20]; % some vector to show
set(t,'String',num2str(outvec)); % convert to string and show it in t
If you do not have the handle to your static text box, then you should modify your code so that you store the handle when you create the text box, as I have stored the one above as the variable t.
Failing that, you can use findobj to find it:
t = findobj('Type','uicontrol','Style','text','Tag','mm'); % works because the 'Tag' was set as 'mm'
outvec = [1 2 3 4 20]; % some vector to show
set(t,'String',num2str(outvec)); % convert to string and show it in t
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!