how to use radio buttons and execute codes under selected button.I have two buttons local histogram and global histogram

3 Ansichten (letzte 30 Tage)
% --- 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

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 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!

Weitere Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by