store value of selected radio button from group button
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
i want get the value of selected radio button from button group i use this code:
u=get(handles.uipanel12,'SelectedObject');
but this code get me a number while the object is a string.(name and tag of radio button)
can u help me?
thanks
채택된 답변
Walter Roberson
2013년 12월 21일
편집: Walter Roberson
2013년 12월 21일
u = get(get(handles.uipanel12,'SelectedObject'), 'Value');
댓글 수: 7
thanks very much!
Wouldn't this always be true? I mean, if it's the selected radio button in a group of radio buttons, its value is true. How could it be anything else? Selecting it means that you're setting it true, by definition.
Yes, you have simply to select the property you want (i.e. 'Value', 'Tag' etc..) If you want the Tag of the radiobutton selected you should do so:
u = get(get(handles.uipanel12,'SelectedObject'), 'Tag');
praveen chandaliya
2017년 9월 8일
편집: Walter Roberson
2017년 9월 8일
Walter Roberson
by default one radio button is selected in button group but i want initial no radio button selected with Buttongroup
praveen chandaliya : That does not appear to be possible in R2014b or later. It appears to me that the first button added to a uibuttongroup automatically has its Value set to 1.
Your options are:
- set() the Value of the first button to 0 after it is added to the uibuttongroup; or
- create a junk button first and add it to the uibuttongroup, and then after the other buttons are added, delete the junk button.
@ Walter Roberson Is it possible to set values of subsequent radio buttons to '3' and '4' ? So that when i select third or fourth radio buttons, only code relevant to that part is executed?
The Value property of a button will be equal to the button's Min property if the button is not selected, and equal to the button's Max property if the button is selected.
So you could set the buttons to have 'Max', 1 for the first button, 'Max', 2 for the second, 'Max' 3 for the third, and so on. Then the Value property of the current button would tell you which of the buttons had been selected.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
