MATLAB: Capturing the same frame

videoframes

My frame is capturing the same beginning video frame in multiple figures. I want the multiple figure to be images of the video as it progrosses, not the same figure for multiple figures. Here is my code. Please fix it
obj = VideoReader('Climate.mp4');
for k = 1 : 5 %fill in the appropriate number
this_frame = read(obj, k);
thisfig = figure();
%thisfig = gcf;
thisax = axes('Parent', thisfig);
image(this_frame, 'Parent', thisax);
title(thisax, sprintf('Frame #%d', k));
end

Best Answer

So don't create a new figure each frame. How does this work:
obj = VideoReader('Climate.mp4');
for k = 1 : obj.NumberOfFrames
this_frame = read(obj, k);
imshow(this_frame);
title(sprintf('Frame #%d', k), 'FontSize', 14);
drawnow; % Force immediate repaint of screen.
pause(0.1); % Increase number to slow it down more.
end