how to get value of uicontrol edit text without calling a function ?
조회 수: 8 (최근 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!