Real time plot from streaming data
Mostrar comentarios más antiguos
How can I plot a graph in real time with data being streamed from yahoo.finance?
Should I use an infinite while loop or a timer? I think neither the two are the most correct solutions since one will always be constrained by their latency and one just want to update the graph whenever the variable is updated.
Respuestas (4)
Nathan Crosty
el 17 de Sept. de 2013
Try this code snippet I have in my inventory as an example.
t = 0 ;
x = 0 ;
startSpot = 0;
interv = 1000 ; % considering 1000 samples
step = 0.1 ; % lowering step has a number of cycles and then acquire more data
while ( t <interv )
b = sin(t)+5;
x = [ x, b ];
plot(x) ;
if ((t/step)-500 < 0)
startSpot = 0;
else
startSpot = (t/step)-500;
end
axis([ startSpot, (t/step+50), 0 , 10 ]);
grid
t = t + step;
drawnow;
pause(0.01)
end
1 comentario
Zibo Wang
el 1 de Jun. de 2017
great! I like this, thank you so much
Rui
el 20 de Sept. de 2013
0 votos
Rui
el 20 de Sept. de 2013
0 votos
Tim DeWolf
el 6 de Sept. de 2016
0 votos
I'm collecting buffer/queue data from a driver in real time using a MATLAB timer in a GUI (guide) and it works. You can still use MATLAB.
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!