ak501
Computer
- Oct 27, 2005
- 4
Hello friends,
I have a problem pausing a process from GUI interface in MATLAB.
So here are the details of my problem
I was trying to plot XY-graph.
So for that i made three buttons in the GUI
say
Plots
Pause ON
Pause OFF
when I press <Plots button> it plots from 1:1000 on x-axis and rand(1000,1) numbers on Y-axis
so I do this in different figure other than using GUI-axes property (as I need it that way)
plotting works fine,
but when I want to pause the plotting in between I cant do it
here is my code, please give some suggestions
plotss.m
function varargout = plotss(varargin)
<all default GUI stuff>
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
plot_example
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
pause on
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
pause off
plot_example.m
function plot_example
x=[1:1000];
y=rand(1000,1);
z=rand(1000,1);
a=[];
b=[];
c=[];
figure(2)
for i = 1:size(x,2)
a=[a;x(i)];
b=[b;y(i)];
c=[c;z(i)];
plotting(a,b,'r')
plotting(a,c,'b')
end
%plot(x,y);
%set(handles.ax,h);
function plotting(xx,yy,colors)
hold on
plot(xx,yy,colors)
drawnow
I have a problem pausing a process from GUI interface in MATLAB.
So here are the details of my problem
I was trying to plot XY-graph.
So for that i made three buttons in the GUI
say
Plots
Pause ON
Pause OFF
when I press <Plots button> it plots from 1:1000 on x-axis and rand(1000,1) numbers on Y-axis
so I do this in different figure other than using GUI-axes property (as I need it that way)
plotting works fine,
but when I want to pause the plotting in between I cant do it
here is my code, please give some suggestions
plotss.m
function varargout = plotss(varargin)
<all default GUI stuff>
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
plot_example
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
pause on
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
pause off
plot_example.m
function plot_example
x=[1:1000];
y=rand(1000,1);
z=rand(1000,1);
a=[];
b=[];
c=[];
figure(2)
for i = 1:size(x,2)
a=[a;x(i)];
b=[b;y(i)];
c=[c;z(i)];
plotting(a,b,'r')
plotting(a,c,'b')
end
%plot(x,y);
%set(handles.ax,h);
function plotting(xx,yy,colors)
hold on
plot(xx,yy,colors)
drawnow