MATLAB: Animated sequence of dots

animationdotsMATLABsequence

Hello
I would like to know if Matlab can easily do this: set a animated sequence of dots that will appear at specific location on a 2 wire-frame surface or cube. The sequence will be generated with precise sequence or randomly etc. If it is possible is there any example of such sequence or what kind of code i should use?
see the image attached
Kind Regards and thanks
Xav

Best Answer

If you have MATLAB R2014b or later, you can use animatedLine
For earlier versions you can use scatter() or plot(), updating the XData and YData properties as you go. For example,
x = []; y = [];
pointsize = 30;
h = scatter(x, y, pointsize, 'k');
for K = 1 : 20
newx = rand(); newy = rand();
x(end+1) = newx;
y(end+1) = newy;
set(h, 'XData', x, 'Ydata', y);
drawnow();
end
But my guess is that you might be looking for Psychophysics Toolbox