|
"Abel Brown" <brown.2179@osu.edu> wrote in message
<fu6c6d$g9g$1@fred.mathworks.com>...
> so i have two radio buttons
>
> if radiobutton1 is selected then only one plot is produced
>
> if radiobutton2 is selected then i want to do a subplot of 3
> different plots
>
> in the pushbutton_callback i have
>
> axes(handles.axes1);
> cla;
>
> ...
>
> switch selection
>
> case 'SNR'
>
> plot(...)
>
> case 'CS'
>
> subplot(3,1,1)
> ...
>
> subplot(3,1,2)
> ...
>
> subplot(3,1,3)
>
> end
>
> the problem is that the GUI crashes when i do the subplots.
>
> the subplot bulges way outside of the axes boundaries and on
> top of all the buttons etc.
>
> Is there some trick to going back and forth between plots
> and subplots in a gui?
>
> Thanks!
Hai,
Try out the following, hope it will work.
As u insert radio buttons inside the Button Group Panel,
similarly insert the axes also in another Button Group Panel
(only one axes, we need not seperate 3 axes).
Say ur radio Button Group Panel is tagged as radio_panel and
axes Button Group Panel as axes_panel. Then write the
following code in function:
radio_panel_SelectionChangeFcn(hObject, eventdata, handles)
h = get(handles.uipanel1,'SelectedObject');
s = get(h,'String');
t = 0:0.01:1;
x = sin(2*pi*3*t);
switch s
case '1 PLOT'
h = subplot(1,1,1,'Parent',handles.axes_panel);
plot(h,x,'r');
case '3 Sub PLOTs'
h1 = subplot(3,1,1,'Parent',handles.axes_panel);
plot(h1,x,'r');
h2 = subplot(3,1,2,'Parent',handles.axes_panel);
plot(h2,2*x,'b');
h3 = subplot(3,1,3,'Parent',handles.axes_panel);
plot(h3,3*x,'g');
otherwise
end
If this is not clear, plz let me know so that i can mail u
the sample program which i have already with me.
Regards,
Ashwini
|