This is the error "Maximum variable size allowed by the program is exceeded". How can I fix it??
조회 수: 56 (최근 30일)
이전 댓글 표시
Dear Sir,
I have this error"Maximum variable size allowed by the program is exceeded" and i do know how i fixed it....
I obtained on this error when I wrote this code:
x1= double(imread('image1.jpg'));
[C,S] = wavedec2(x1,1,'db5');
chd2 = wrcoef2('h',C,S,'db5',1);
D1=[];
D1 =[D1 chd2];
[h w] = size(D1)
s=2
t = 3;
b = 2*t+1;
N = h-b+1
M = w-b+1
L = N*M
r = [1:s:N]
r = [1:s:N]
r = [r r(end)+1:N]
c = [1:s:M]
c = [c c(end)+1:M]
X = zeros(b*b,L,'single')% here, I obtained on the error massage?????
where i can not make zero matrix...
I would like to help me in fixed this error...if this possible??
Thank you very much
댓글 수: 5
Randy Souza
2012년 11월 29일
I have restored the original text of this question.
Mohamed Elwakdy, this question has a clear subject and multiple answers, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.
답변 (2개)
Walter Roberson
2012년 11월 7일
You need to either reduce L somehow, or switch to a 64 bit MATLAB with more than 9 Gb of memory.
Consider whether you algorithm really needs all of those locations.
Consider whether you will have a lot of zeros; if so then sparse matrices might help.
What is it that you are trying to accomplish?
댓글 수: 2
Walter Roberson
2012년 11월 7일
Why do you want to make a testing block, etc. ? What are you trying to compute? For example is this a radar application?
Walter Roberson
2012년 11월 7일
What will you be doing with X afterwards? Would it be possible to do some of the calculation in parts? Compute some of X and process that portion down to a smaller size, keep some overlap from X if needed but throw most of the already-processed part away, compute more of X, process that down, and so on?
Jan
2012년 11월 6일
편집: John Kelly
2013년 11월 13일
The maximum size of variables can be optained by the command computer. Because your b is small, L must be giantic, such that the internal addressing gets an overflow. Depending on the architecture, this can be at 2^40 (divided by b*b=49...).
댓글 수: 3
Jan
2012년 11월 7일
@Mohamed: As long as b=7, L = 23352784 should work. Are you sure that Matlab shows the error message for these values?
Exceeding the maximum size of arrays means, that you try to reserve more memory than Matlab and the operating system can access. But even below this limit you need very much RAM to process large arrays in a reasonable amount of time. So I assume, currently the problem you work on is too big for computers, and even if you split it in parts the calculations could take years.
But these assumptions are based on guessing only, because we still do not know the actual size of the problem, which produces the error message. Please type this in the command line:
dbstop if error
Then start your program. Matlab stops, when the error occurs and you can check the values of b and L.
Walter Roberson
2012년 11월 7일
(7 * 7) * 23352784 * 8 (bytes per double) = 9154291328 which is a little over 9 Gb, which is more than would be allowed on a 32 bit version of MATLAB.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!