- run the code on a machine with more RAM (like a server); or if such a computer is not available
- try to make the figure you are capturing smaller (your frames currently have a resolution of 1902x968 pixels). Change the line
Animation video from data points, giving error below
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
muhammad choudhry
el 2 de Sept. de 2021
Respondida: muhammad choudhry
el 3 de Sept. de 2021
Hi,
I am making the the animation from the data points. but I am gettig the error below, can anyone help me come over this error. Also if anyone can help me recording this data like 1 point for 1 fps that be great. Below is the error and the code I am using.
Error:
Error using VideoWriter/writeVideo (line 414)
Requested 968x1902x3x2184 (11.2GB) array exceeds maximum array size preference. Creation of
arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive.
Error in graphanimation (line 28)
writeVideo(video,F);
Code:
close all; clear all; clc;
%plotting the graph animation
a=readmatrix('pressure_experiement.ods');
x=a(:,7);
y=a(:,11);
curve = animatedline('color','b','Marker','x');
set(gca,'XLim',[0 500],'YLim',[0 90]);
grid on;
title('CircleSide_Awaypoint');
xlabel('Head (mm)');
ylabel('Pressure (mmH2o)');
set(gcf,'Units','normalized','OuterPosition',[0 0 1 1]);
for i=1:length(x)
addpoints(curve,x(i),y(i));
drawnow
F(i)=getframe(gcf)
%pause(0.5)
end
hold all
video = VideoWriter ('away.avi','MPEG-4')
video.FrameRate = 1;
open(video)
writeVideo(video,F);
close(video)
0 comentarios
Respuesta aceptada
Konrad
el 2 de Sept. de 2021
Editada: Konrad
el 2 de Sept. de 2021
Hi Muhammad,
it seems that the video you are trying to create is too large to fit into memory. You can either
set(gcf,'Units','normalized','OuterPosition',[0 0 1 1]);
to e.g.
set(gcf,'Units','pixels','Position',[0 0 1280 720]);
to get a resolution of 1280x720. If you still get the error, further reduce the resolution.
Best, Konrad
EDIT: --------------------------
If you need the high resolution, another way to reduce memory requirements might be to split the animation into multiple videos (e.g. 10 videos each containing 218 frames or so) and then use a video editing software (e.g. avidemux) to merge videos.
0 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!