I have a Matlab code which plots the variable value against the loop iterations.
I have considered random values as variable value just for this example.
function varargout = myplot(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @myplot_OpeningFcn, ...
'gui_OutputFcn', @myplot_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before myplot is made visible.
function myplot_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
function varargout = myplot_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
axes(handles.axes1);
iif = 0;
i = 1;
y = 0;
while (i < 1000)
yf = rand(1);
y = [y, yf];
iif = [i,iif];
i = i + 1;
plot(iif,y);
pause(0.001);
end
How can I replace iif = [i,iif];
into a timer ?
All I want to have is data plotted against the time(in seconds) instead of data vs loop iterations. Anyone have any idea ? Thanks.