Radiobutton control
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have six radio buttons and a pushbutton in my gui .I want depending on which radiobuttons are pressed by the user the gui to be able to plot different histograms.And if no radiobutton is pressed a message to appear and warn the user tha he should push a radio button .My code is this :
% --- Executes on button press in radiobutton12.
function radiobutton12_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton12 (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 radiobutton12
handles.radiobutton12=get(hObject,'Value');
guidata(hObject,handles)
...
and other 5 radiobuttons Callbacks ....and then the pushbutton :
% --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton19 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if (get(handles.radiobutton12 ,'Value') == get(handles.radiobutton12 ,'Min'))&& (get(handles.radiobutton13 ,'Value') == get(handles.radiobutton13 ,'Min'))&& (get(handles.radiobutton14 ,'Value') == get(handles.radiobutton14 ,'Min'))&& (get(handles.radiobutton15 ,'Value') == get(handles.radiobutton15 ,'Min'))&& (get(handles.radiobutton16 ,'Value') == get(handles.radiobutton16 ,'Min'))&& (get(handles.radiobutton17 ,'Value') == get(handles.radiobutton17 ,'Min'))
msgbox('You should select at least one radiobutton in order to evaluate the condition of the patient and see the histograms','Patient Progress','warn')
return
else
figure('Name','b value histograms ','NumberTitle','off');
kan=max(max(handles.hist),max(handles.hist1));
xlim([0 255])
plot(handles.hist/kan,'b');
h = legend('Before Treatment','Location','NorthEast');
set(h,'Interpreter','none')
xlabel('b-value Signal_Density');
ylabel('Volume Fraction of Tumor');
hold on
if handles.radiobutton12==1;
plot(handles.hist1/kan,'r');
h= legend(h,'After Treatment','Location','NorthEast');
set(h,'Interpreter','none')
end
...and it continues for each radiobutton press.
when i press the push button without any pressed radiobutton the warning message appears but when i push a radioutton matalb gives me this error ??? Error using ==> get There is no 'Value' property in the 'figure' class.
Error in ==> DWI_Liver_Analyzer>pushbutton19_Callback at 2388 if (get(handles.radiobutton12 ,'Value') == get(handles.radiobutton12 ,'Min'))&& (get(handles.radiobutton13 ,'Value') == get(handles.radiobutton13 ,'Min'))&& (get(handles.radiobutton14 ,'Value') == ge
What should i change can anybody help me ?
Thanks in advance .
0 Commenti
Risposte (2)
Sean de Wolski
il 21 Mag 2012
Run:
dbstop if error
And then run your program as you were. Reproduce the error and the debugger will stop on line 2388. On this line inspect each variable and each call to |get()}. It should be apparent at this point that one of the handles is actually to a figure trying to get its 'Value' property which it doesn't have.
0 Commenti
Paraskevas Papanikolaou
il 21 Mag 2012
1 Commento
Sean de Wolski
il 21 Mag 2012
Because this callback must be getting called by the figure.
Look at the figure's callbacks in ther GUIDE inspector.
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps 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!