I have two radio buttons radiobutton1
,radiobutton2
(not in a group) in GUI, each of them plot on the axes1
a specific function. If I select radiobutton1
and radiobutton2
the two functions will be plotted on the axes1
. If I unselect radiobutton1
there will be only function of radiobutton2
on the axes1
, the function of radiobutton1
will not be seen anymore. The same for radiobutton2
. Or If I unselect two radio buttons nothing will be plotted.
I have defined if
loop for each radio buttons such as
v = get(hObject,'Value');
if (v == 1)
axes(handles.axes1);
plot(sin(x));
hold on;
else
cla;
end
I tried cla
to clear axes1
, but it clears all the plots when one radio button is unselected.
I have written two radio buttons for the sake of simplicity. But I have many of them. So please think the solution for many radio buttons.
How can this be done?