How to make my output display in static box(GUI)

my output is currently printing out in the command window, i would like to display in the static text box

Respuestas (1)

Voss
Voss el 12 de Abr. de 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 comentarios

kkkrdrr
kkkrdrr el 12 de Abr. de 2022
i have already have a static text box tag:mm
then i have a outtvec
how should i display ?
replacing outtvec with t?
Voss
Voss el 12 de Abr. de 2022
Editada: Voss el 12 de Abr. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 12 de Abr. de 2022

Editada:

el 12 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by