- 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
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Konrad
2021년 9월 2일
편집: Konrad
2021년 9월 2일
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
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!