Speeding up video creation
4 次查看(过去 30 天)
显示 更早的评论
I am trying to create a video in matlab from some data I have produced. I have data of size 5242x5000 double against nodes 5242x2. When I try to plot my movie the run time is into the hours which isn't practical and I do not understand programming enough to know where to go, any help will be appreciated.
Unfortunately I cannot attach my data.
tic
T=its(2)
M = struct('cdata', cell(1,T+1), 'colormap', cell(1,T+1)); %Pre allocates the structure
hold off
% hold on;
% Prepare the new file.
figure(5);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
file=char('NeumannCluster-dt'+ string(dt)+'DateTime'+string(datestr(now,'mm-dd-yyyy-HH-MM')));
% vidObj = VideoWriter(file, 'MPEG-4');
vidObj = VideoWriter(file);
open(vidObj);
% %Replace with a While
its=size(results_matrix)
for i=1:T
i
trimesh(connectivity_matrix, nodes(:,1),nodes(:,2),results_matrix(:,i));
hold on
plot(boundarynodeGeometry(:,1),boundarynodeGeometry(:,2), 'b-'); %Plots stationary boundary points
zlabel('Temperature');
xlabel('X Position');
ylabel('Y Position');
colorbar;
set(gcf, 'color', 'white');
view(0,90) ;
M(i)=getframe(gcf);
writeVideo(vidObj,M(i));
end
% Close the file.
close(vidObj);
toc
2 个评论
Geoff Hayes
2019-5-21
I'm not too clear on the statement 5242x5000 double against nodes 5242x2. Could you clarify please? Also, what is T? (I'm guessing 5000?)
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!