Step by frame by frame in Matlab
1 answer
If your movie was created with "getframe", you can use the following code:
This creates an example movie:
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
% Record the movie
for j = 1:20
surf(sin(2*pi*j/20)*Z,Z)
F(j) = getframe;
end
% Play the movie
figure(1);clf;
movie(F)
This checks every frame, one at a time:
for j=1:20
[X,map] = frame2im(F(j));
figure(2);clf;
image(X);
pause;
end
Pressing the spacebar will release "pause" so you can independently explore each frame.
+2
source to share