how to get value of uicontrol edit text without calling a function ?
2 ビュー (過去 30 日間)
古いコメントを表示
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..
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!