GUIDE and buttongroup
조회 수: 7 (최근 30일)
이전 댓글 표시
I have a button group with 2 radio buttons: MHz and GHz.
I don't need to run a callback function on selection changes. My GUI also has a "RUN" button. When this is clicked, it goes through a callback routine, where I do want to check the selected value in the button group. I tried this:
switch get(handles.BW_buttongroup,'SelectedObject') % Get Tag of selected object.
case 'MHz'
BW_units = 1E6;
otherwise
BW_units = 1E9;
end
But it did not work. In fact,
disp(get(handles.BW_buttongroup,'SelectedObject'));
returns 2.600024414062500e+002
The MATLAB document says this is a scalar handle? I am not sure how this works.
SelectedObject
scalar handle
Currently selected radio button or toggle button uicontrol in the managed group of components. Use this property to determine the currently selected component or to initialize selection of one of the radio buttons or toggle buttons. By default, SelectedObject is set to the first uicontrol radio button or toggle button that is added. Set it to [] if you want no selection. Note that SelectionChangeFcn does not execute when this property is set by the user.
_
댓글 수: 0
채택된 답변
Fangjun Jiang
2011년 10월 3일
Yes, the 'SelectedObject' is a handle. You could do this:
h=get(handles.BW_buttongroup,'SelectedObject');
get(h,'Tag')
댓글 수: 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!