Last active
September 2, 2016 05:10
-
-
Save drhirsch/ed1482a4b16a98efeda87c60b3017594 to your computer and use it in GitHub Desktop.
example animated movie in Matlab or Octave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% create data, 25 frames of 512x512 pixels | |
data = rand(512,512,25); | |
%% create blank image | |
img = imagesc(rand(512)); | |
ht = title(''); % to show frame number | |
%% for loop to play "movie" | |
for i = 1:25 | |
set(img,'cdata',data(:,:,i)) % update latest frame | |
set(ht,'string',['Frame (',num2str(i),'/25)']) | |
pause(0.2) % feel free to reduce, but keep greater than 0 to ensure redraw | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment