how to use radio buttons and execute codes under selected button.I have two buttons local histogram and global histogram
조회 수: 1 (최근 30일)
이전 댓글 표시
% --- Executes on button press in local_hist.
function local_hist_Callback(hObject, eventdata, handles)
% hObject handle to local_hist (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of local_hist
% --- Executes on button press in global_hist.
function global_hist_Callback(hObject, eventdata, handles)
% hObject handle to local_hist (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of global_hist
댓글 수: 0
채택된 답변
Geoff Hayes
2014년 6월 26일
Anamika - The link http://www.mathworks.com/help/matlab/creating_guis/add-code-for-components-in-callbacks.html#f10-1001546 describes the Button Group panel which can be used (for example) to manage one or more radio buttons. So you would create the button group widget, and add your two radio button widgets (for Local Histogram and Global Histogram) inside of this panel. As described in the link, the SelectionChangeFcn callback can be created for the button group widget which will fire whenever the user presses a different radio button and invoke the appropriate code given the user's selection of the button.
Take a look at the link, write the code, and see what happens!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
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!