matlab - How to update data in a plot do create animations in octave -


i'm trying plot 2d array line line each time in loop pause command create animations. did in matlab , octave had plot command inside loop octave makes whole thing slower. saw somewhere can update data in plot, reason doesn't work. i'm doing wrong here?

say x constant array d=(1*m) , y variable array d=(n*m). d -> dimensons

h=plot(x,y(:,1),'-'); while true     i=1:length(t)         axis([0 l -a a]);         hold on;         set(h,'ydata',y(:,i));         pause(0.01)         cla     end  end 

you shouldn't need hold on in code. following works fine in octave 3.8.1 fltk graphics toolkit:

t = linspace (0, 2*pi, 100); y = sin (0.1*t); h = plot (t, y); f = 0.2:0.1:2*pi   y = sin (f*t);   set (h, 'ydata', y); endfor 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -