MATLAB: How to stop uicontrol from changing the scalar input to a vector

convertscalaruicontrolvector

I am building a GUI and have noticed that a few of my inputs have been converted from a scalar into a vector by a uicontrol function. Here is a sample code which shows that my scalar input being transformed into a vector matrix:
clc
fig=figure('Visible','on','Menu','none','Resize','off','NumberTitle','off','Name',...
'test3','Position',[50 50 500 500],'color',[0.7 0.7 0.7]);
x = 100
value_x = x
size_x = size(x)
scalar_x = isscalar(x)
hx = uicontrol('String',x,'Tag','x','Style','edit','Parent',fig,'Position',[100 192 40 15]);
value_hx = get(hx,'String')
size_hx = size(get(hx,'String'))
scalar_hx = isscalar(get(hx,'String'))
Any ideas on how to stop or work around this?
Thanks in advance for your help!

Best Answer

a=get(hx,'String') % is char
b= str2double(a) % convert to double
isscalar(b)