plot output of timer function
4 ビュー (過去 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!