-
Notifications
You must be signed in to change notification settings - Fork 5
/
Make_Movie.m
38 lines (31 loc) · 1.04 KB
/
Make_Movie.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Make_Movie(app)
% Make_Movie(app)
% This function makes a movie of the spatial JHU data selected in the
% COVID19_Matlab_App (app).
Nt = size(app.DATA,2);
% Creates and opens a new movie file
k = 1;
while exist(['movies/',app.RegionDropDown.Value,'_',num2str(k),'.mp4'],'file')
k=k+1;
end
vidObj = VideoWriter(['movies/',app.RegionDropDown.Value,'_',num2str(k),'.mp4'],'MPEG-4');
open(vidObj);
MovDays = app.MovDays.Value;
% Iterate through time
for j = Nt-MovDays:Nt
[~,cblab,ticklabs,K] = pop_out_map(app,j,Nt,Nt-MovDays);
hcb2 = colorbar('east');
hcb2.Position([2,4]) = [0.6,0.3];
set(get(hcb2,'Xlabel'),'String',cblab)
set(hcb2,'Ticks',linspace(0,1,length(K)),'TickLabels',ticklabs)
if j<=Nt
title(['Map of Pandemic (',app.map_what.Value,') on ',app.dates{j}]);
else
str = ['Prediction of Pandemic for ',datestr(datenum(app.dates{end},'mm/dd/yyyy')+j-Nt)];
title(str(1:end-5));
end
drawnow
currFrame = getframe(gcf);
writeVideo(vidObj,currFrame);
end
close(vidObj);