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?

 Accepted Answer

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 Comments

Mai Le Thai
Mai Le Thai on 6 Feb 2019
Edited: Rik on 6 Feb 2019
Thanks Rik!
You're welcome

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2018b

Tags

Asked:

on 6 Feb 2019

Commented:

Rik
on 6 Feb 2019

Community Treasure Hunt

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

Start Hunting!