plot output of timer function

4 ビュー (過去 30 日間)
gaia buratti
gaia buratti 2012 年 10 月 22 日
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 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by