Speeding up video creation

7 次查看(过去 30 天)
KieranSQ
KieranSQ 2019-5-21
评论: KieranSQ 2019-5-21
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
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?)
KieranSQ
KieranSQ 2019-5-21
Hello,
Apologies, I was hoping to upload the data. So my data (z position/colour) is a matrix of size 5242x5000 (rows,columns) and nodes is the x,y positions of a vector.
T is 5000, the number of iterations i took to produce my data - this variable can be changed slightly without impacting the data. I mostly want to produce a video for qualitative purposes.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by