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

4 Ansichten (letzte 30 Tage)
LO
LO am 30 Mai 2019
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');
eav=get(ea,'string')
if editA==1
widths1(i)=eav;
end
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..

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by