How to change text on a panel?

My question is:
-I have created a panel with text in it :
uicontrol(handles.vehicleData, 'Style','text','Position', [148 -12 87 100], 'String',a,'FontSize',11);
-The variable a updates new values every time.
-Now I want to change the text in the panel without using the command uicontrol again. How can I do this?

 Respuesta aceptada

Rik
Rik el 6 de Feb. de 2019

0 votos

You can use the handle:
%create text field
a='0';
h_txt=uicontrol(handles.vehicleData, 'Style','text','Position', [148 -12 87 100], 'String',a,'FontSize',11);
%change text
a='1';
set(h_txt,'String',a)

2 comentarios

Mai Le Thai
Mai Le Thai el 6 de Feb. de 2019
Editada: Rik el 6 de Feb. de 2019
Thanks Rik!
Rik
Rik el 6 de Feb. de 2019
You're welcome

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 6 de Feb. de 2019

Comentada:

Rik
el 6 de Feb. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by