How to change text on a panel?

5 views (last 30 days)
Mai Le Thai
Mai Le Thai on 6 Feb 2019
Commented: Rik on 6 Feb 2019
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

Rik
Rik on 6 Feb 2019
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!
Rik
Rik on 6 Feb 2019
You're welcome

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!