button to activate textboxes in GUI
조회 수: 2 (최근 30일)
이전 댓글 표시
채택된 답변
William
2011년 9월 20일
Use this:
exportwhatever = get(handles.("textboxname"),'string')
Put this code in the function callback. It will go to the text box and return in string format what is in the textbox.
댓글 수: 2
Matthew
2019년 7월 22일
I used the function above but I still get an error:
"Undefined variable "handles" or class "handles.text1". Text1 is the tag of my textbox. But, i do not understand how to access the handles from my textbox.
I tried
set(handles.text1, 'String', works);
where works is just a string. So, how do I get to recognize "handles" from my textbox in my button callback function
추가 답변 (1개)
Grzegorz Knor
2011년 9월 20일
You have to create callback function:
댓글 수: 2
Grzegorz Knor
2011년 9월 20일
function test
uicontrol('Style','pushbutton','String','read','callback',@pb_clbck)
h = uicontrol('Style','Edit','String','write me!',...
'Units','normalized','Position',[.4 .45 .2 .1]);
function pb_clbck(src,evnt)
disp(get(h,'String'))
end
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!