Speeding up video creation

2 views (last 30 days)
KieranSQ
KieranSQ on 21 May 2019
Commented: KieranSQ on 21 May 2019
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 Comments
Geoff Hayes
Geoff Hayes on 21 May 2019
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 on 21 May 2019
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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!