1

I am writing a MATLAB code to plot an x-y coordinate matrix. The matrix is constantly updated(as fast as micro or milliseconds) by obtaining raw data from an external device. I need to update the plot as and when the matrix changes. Essentially my requirement is to generate something like a video of how the matrix evolves, by plotting it.

This is a piece of code I tried:

(b is the 2D matrix which is constantly updated)

while(<condition>) 
            b(i,1)=<x-coordinate>      %obtained as raw data from external device
            b(i,2)=<y-coordinate>      %obtained as raw data from external device
            scatter(b(:,1),b(:,2));
end

The problem here is that the b matrix receives values at such a fast rate that, the scatter() function lags while plotting.

How do I get a smooth dynamic plot of the constantly updated matrix?

Thanks!

  • http://www.mathworks.co.uk/help/matlab/ref/linkdata.html or this general guide http://www.mathworks.co.uk/help/matlab/data_analysis/making-graphs-responsive-with-data-linking.html and also http://www.mathworks.co.uk/help/matlab/creating_plots/example--specifying-a-data-source.html. Plenty of example to take from, not sure that the real time plotting can be accomplished in milliseconds nor if it's meaningful. – Oleg Aug 31 '13 at 20:40

0 Answers0