how to use radio buttons and execute codes under selected button.I have two buttons local histogram and global histogram
1 view (last 30 days)
Show older comments
Anamika baruah
on 25 Jun 2014
Edited: Image Analyst
on 26 Jun 2014
% --- 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 Comments
Accepted Answer
Geoff Hayes
on 26 Jun 2014
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!