Back to the Control Room



Adavnced Topics

Advanced Topics

One of the cool features available in MATLAB 5 and beyond are movies. Unfortuantely, I was unable to put a movie up on this webpage. However, if you have access to Matlab, you can create your own movie. The code below suggests one possible implementation:


nframes = 50

x = rand(n,1)-0.5;
y = rand(n,1)-0.5;
h = plot(x,y,'.')
set(h,'MarkerSize',18)
axis([-1 1 -1 1])
axis square
grid off

M = moviein(nframes)

for k = 1:nframes
x = x + s*randn(n,1);
y = y + s*randn(n,1);
set(h,'XData',x,'YData',y)
M(:,k) = getframe;
end

movie(30)



MATLAB is much more powerful than generally imagined. For example, you probably did not realize that one can play games in MATLAB!!!

Click on the picture below to see the tetris.m file, written by Maurice Smith. You can than use the "Save As" feature in your browser to download the file. Note: You will need MATLAB on your computer to run the game.