필터 지우기
필터 지우기

Error using meshgrid function.

조회 수: 7 (최근 30일)
VIJENDRA
VIJENDRA 2014년 10월 9일
댓글: VIJENDRA 2014년 10월 10일
I have 2 matrices 'A' and 'B' both of size 500*500. when i am trying to create meshgrid using
[X1,Y1] = meshgrid(A,B);
this shwo error "Out of memory. Type HELP MEMORY for your options. Error in meshgrid (line 58) xx = xrow(ones(size(ycol)),:);"
Can anyone tell why is it happening? Is there any size limit for the variable?
  댓글 수: 2
Andrew Reibold
Andrew Reibold 2014년 10월 9일
I get the same thing with 500x500, but it works ok for 100x100
The bottom line, is that to do that exactly as written you will need a bigger toaster.
Star Strider
Star Strider 2014년 10월 9일
You may not need to use meshgrid.
What are you calculating or plotting?

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

채택된 답변

Andrew Reibold
Andrew Reibold 2014년 10월 9일
편집: Andrew Reibold 2014년 10월 9일
The reason is this.
Lets say I make two 500x500 matrices using the following.
A = ones(500,500);
B = 4*ones(500,500);
Lets look at how big one of those is
whos A
Name Size Bytes Class Attributes
A 500x500 2000000 double
2,000,000 Bytes is 2 Megabytes.
Now to run meshgrid, the grid vector A is replicated numel(B) times to form the columns of X
How many times is that?
numel(B)
ans =
250000
2BM * 250,000 is the same as 500GB
Do you have 500GB available?
You can check using memory. Here is an example
memory
Maximum possible array: 89643 MB (9.400e+10 bytes) *
Memory available for all arrays: 89643 MB (9.400e+10 bytes) *
Memory used by MATLAB: 3493 MB (3.663e+09 bytes)
Physical Memory (RAM): 16308 MB (1.710e+10 bytes)
Here I can see that I only have enough space for about 90GB of array space when for this process I will need 500GB. This means I result in the same error as you.
meshgrid(A,B)
Error using repmat
Out of memory. Type HELP MEMORY for your options.
Error in meshgrid (line 58)
xx = repmat(xrow,size(ycol));
And that is why you are having your problem! Not enough memory available on your computer. You will need to try to split the problem up or perhaps lower grid resolution if possible.
I hope this explanation answered your question, good luck!
  댓글 수: 1
VIJENDRA
VIJENDRA 2014년 10월 10일
Thank you Andrew Reibold, its very good description.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by