out of memory
1 次查看(过去 30 天)
显示 更早的评论
clear all
mov = aviread('book.avi');
xy=zeros([size(mov(1).cdata),length(mov)], 'uint8');
for ii=1:537
figure(10)
ii
xy(:,:,:,ii)=mov(ii).cdata;
imshow(xy(:,:,:,ii));
endwhen I read the code,these message also show again.
pleas teach me how to do
thank!
??? Error using ==> zeros
Out of memory. Type HELP MEMORY for your options.
Error in ==> framebook at 3 xy=zeros([size(mov(1).cdata),length(mov)], 'uint8');
0 个评论
采纳的回答
Walter Roberson
2012-2-13
I did warn you in your previous thread on this topic to expect to run out of memory. No matter how much memory you have, there will be a movie bigger than that.
Are you certain that you need to store the data as a 4D array, and cannot process it in the mov struct instead?
Anyhow:
numframe = 537;
ii = 1;
thisframe = aviread('book.avi', ii);
xy = repmat(thisframe.cdata, [1, 1, 1, numframe]);
figure(10);
ii
imshow(thisframe.cdata);
drawnow();
for ii = 2 : numframe
thisframe = aviread('book.avi', ii);
xy(:,:,:,ii) = thisframe.cdata;
ii
imshow(thisframe.cdata);
drawnow();
end
Please expect this to be notably slower than your previous code. As usual, fast operations depend upon having a lot of memory, which you do not have.
更多回答(1 个)
Sean de Wolski
2012-2-13
you're trying to create an array the size of
[size(mov(1).cdata),length(mov)]
i.e.
prod([size(mov(1).cdata),length(mov)])
many elements.
How much RAM do you have? Are you on a 64bit system (capable of having more than 3gb of memory)?
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!