plot output of timer function
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!