maximum variable size allowed by the program is exceeded but it's not

조회 수: 1 (최근 30일)
Leo Simon
Leo Simon 2015년 9월 13일
댓글: Leo Simon 2015년 9월 20일
There have been many many threads on this topic but none seem to apply to my case.
I'm running 64 bit matlab so that
[~,maxSize]=computer
returns
maxSize = 2.8147e+14
I'm working with a variable x which is a 10000 by 10000 array of scalars,
having approximate size 800000000, i.e., approx 1e-6 of maxSize.
I can compute mean(mean(x)), but when I try to compute
mean(mean(x(rows,cols))) where x(rows,cols)) is roughly a quarter the size of x,
I receive the dreaded error
Maximum variable size allowed by the program is exceeded.
even though, obviously, x(rows,cols) is minute, relative to maxSize.
Is there anyway to get around this problem?
thanks very much for any advice!
Leo
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 9월 13일
Are there possibly duplicates among rows or cols?
Does the same thing happen if you assign x(rows,cols) to a variable and then mean(mean()) ?
Have you considered using mean2() ?
Leo Simon
Leo Simon 2015년 9월 20일
Thanks Walter. I discovered that when I reshaped my matrix into a vector, v, and computed mean(v(rows)) everything worked fine, and very quickly. Very odd, since the only change was a reshape, but since it worked, I'm happy.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by