필터 지우기
필터 지우기

save radio button value

조회 수: 3 (최근 30일)
fatemeh
fatemeh 2013년 12월 21일
댓글: Image Analyst 2013년 12월 21일
hi i have a uipanel with many button in it. when i want to store the value of radio button i use this code: u=get(handles.uipanel12,'SelectedObject'); assignin('base','up',u);
but the value in up is not string. i want the string name of radio button plz help me thanks

답변 (1개)

Image Analyst
Image Analyst 2013년 12월 21일
Query the radio button itself, not the panel. The radio button does have a tag and other properties. Only use the panel for the click callback.
radioChecked = get(handles.radioButton1, 'Value');
Never use assignin() - it's virtually never needed. I've written hundreds or thousands of programs and have never needed to use it. You don't want to be transferring and collecting all your variables into the base workspace - that is bad practice. There is a reason why there are different workspaces - you want to keep things in scope only where they should be in scope, not visible to the whole computer where some other function, which decided to use the same variable name for a different purpose, suddenly stomps on the variable you had set from a different function.
  댓글 수: 2
fatemeh
fatemeh 2013년 12월 21일
because i want to save them into a vector...
Image Analyst
Image Analyst 2013년 12월 21일
That is not a response to anything I said.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by