how to use radio buttons and execute codes under selected button.I have two buttons local histogram and global histogram
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Anamika baruah
il 25 Giu 2014
Modificato: Image Analyst
il 26 Giu 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 Commenti
Risposta accettata
Geoff Hayes
il 26 Giu 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!