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!