plot output of timer function
3 views (last 30 days)
Show older comments
Hi everyone,
I am pretty new in Matlab and it's the first time I use the timer function. My purpose is to plot a variable that is the output of the timer callback function. I wrote this
f=start_timer;
b=f();
t=1:rows(b);
plot(t',b);
linkdata on
end
Where start_timer is a nested function as below:
function [display_fn] = start_timer
MyTimer = timer('TimerFcn', @RND, 'Period',10, 'ExecutionMode', 'fixedRate');
display_fn = @TimerDisplay;
start(MyTimer);
a=0;
function RND(g, h)
a=random('Normal',0,1,10,1);
end
function b = TimerDisplay
b = a;
end
end
end
When I run the code the plot with the initial value appears but it never updates, any help or suggestion?
Thank you
Gaia
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!