plot output of timer function

5 visualizzazioni (ultimi 30 giorni)
gaia buratti
gaia buratti il 22 Ott 2012
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

Risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by