how to get value of uicontrol edit text without calling a function ?

3 views (last 30 days)
I am trying to edit some data in real time by using a uicontrol edit box.
the box prompt me each value taken from an array (widths1), in a while loop (while i <= length(widths1)).
I would like to be able to rectify the value widths1(i) by typing in a number but somehow adding the function with the callback outside the while loop does not work.
I circumvented the problem in similar cases by adding a callback to a command in between ' ' (example 'edit = 1')
and adding an if cycle outside the uicontrol (example if edit==1, do something, end;)
however it does not seem to work in this case
ea=uicontrol('style','Edit','string',widths1(i),'Position',[510 650 50 20],'callback','editA=1');
if editA==1
I could also try
ea=uicontrol('style','Edit','string',widths1(i),'Position',[510 650 50 20],'callback','widths1(i)=XXX');
where XXX should be the updated 'string' value of the box... but somehow using get(ea,'value') inside the command does not work becasue "ea" is not recognized as object
I am stuck..

Answers (0)


Community Treasure Hunt

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

Start Hunting!