Info

This question is closed. Reopen it to edit or answer.

error: Maximum variable size allowed by the program is exceeded. in line matrix = zeros((m-63)*(n-63), 2+64*64);

1 view (last 30 days)
count = 1; j = 1; matrix = zeros((m-63)*(n-63), 2+64*64);
while(j+63<m) k = 1; while(k+63<n) dum=zeros(1,64*64); dum(1:(min(m-j+1,64)*(min(n-k+1,64))))=reshape(img1(j:min(j+63,m),k:min(n,k+63)),1,(min(m-j+1,64)*(min(n-k+1,64)))); matrix(count, :) = [j,k, dum]; count = count+1; k = k+1; end j = j+1; end
  1 Comment
John D'Errico
John D'Errico on 7 Jan 2015
Edited: John D'Errico on 7 Jan 2015
Make smaller matrices. Get more memory. Use a 64 bit version of matlab.
Oh, and if you want someone to understand what you are trying to do here to re-write your code, learn to format your code so it is readable. That requires one click of a button when you type it in.
You might also explain something about what it is the code does, so that someone might have a chance to rewrite it.
My point is, if you want help, then make it easy for someone to help you, rather than forcing them to dig through a strung out mess of un-commented code that does some mysterious operation.

Answers (1)

Guillaume
Guillaume on 7 Jan 2015
Edited: Guillaume on 7 Jan 2015
Assuming a smallish image of size 640x480, you're trying to allocate an array of size (577*417) * (2+64*64) * 8 = 7888125456 kb or just under 8GB. Have you got that much memory?
If your images are even bigger, you'll need a huge amount of memory since your allocating room for 4608 times the size of one image.

This question is closed.

Community Treasure Hunt

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

Start Hunting!