MATLAB: How to change text on a panel

MATLABmatlab gui

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?

Best 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)