- 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
3 次查看(过去 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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!