This is a Matlab code I found for real time plot of Arduino output:

a = arduino(‘COM3’);

interv = 1000;

passo = 1;

t=1;

x=0;

while(t<interv)

b=a.analogRead(0);

x=[x,b];

plot(x);

axis([0,interv,0,1024]);

grid

t=t+passo;

drawnow;

end

I don’t understand how x=[x,b] works. What happens to x through each iteration?