Video Processing: maximum variable size allowed by the program is exceeded?

Hi all,I'm now working on a project about Video processing, and I've having some problems. I'm processing some jpeg images which is 240*360 pixels, thus I have to create a matrix of 240*360 to store some processed data for each pixels, I tried to create such matrix using the command M=zeros(240:360) and it prompted me the error message 'maximum variable size allowed by the program is exceeded'. However, I tried to type the command M=zeros(360) and it works.
I don't really understand the situation, M=zeros(240:360) should return a matrix of 240*360 which contains 86400 elements, while the later command: M=zeros(360) should return a matrix of 360*360 which contains 129600 elements, obviously the later matrix occupies much more memory than the first one. But the program just allowed me to do the later operation, I'm now confused with the situation.
Indeed I can continue my project with a 360*30 matrix for each frames, however it doesn't seem to be efficient enough since there's more than thousands of frames for each video. Any answers will be appreciated:)

 Akzeptierte Antwort

KSSV
KSSV am 17 Mär. 2017
Bearbeitet: KSSV am 17 Mär. 2017
You must use
M=zeros(240,360) ; % this gives zeros matrix of size 240*360
When you type
M = zeros(240:360)
It tries to create a n dimensional matrix which goes out of memory. I tried to create a matrix like below, see what MATLAB says:
M=zeros(24:30) ;
Error using zeros Requested 24x25x26x27x28x29x30 (76.4GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive. See array size limit or preference panel for more information.

2 Kommentare

OMG, thanks for your answer. Now I see how stupid my question was:( My heartfelt thanks again:)!!
KSSV
KSSV am 17 Mär. 2017
Bearbeitet: KSSV am 17 Mär. 2017
Don't worry, we learn things by making stupid mistakes. I do make many stupid mistakes daily. ;)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

am 17 Mär. 2017

Bearbeitet:

am 17 Mär. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by