Out of memory error for loop code

조회 수: 3 (최근 30일)
Sebastian
Sebastian 2014년 2월 17일
댓글: Iain 2014년 2월 17일
Hi everyone, I have a very simple code in which I want to find the correlation distances from one point to all the other points in the matrix. I am using bsxfun to find those distances and I am using imread as the function to read an image (The image will give me the points of the matrix).
Since the image is very big, matlab cannot make all the distances because I do not have enough memory in my computer. I tried using a supercomputer which is located in my univesity, the problem is that the supercomputer has only 96gb and I need more than that. I want to read the image by parts, but since I am trying to read the distances, it will change. For example
I have a matrix A:
1 0 0 0 1
0 0 1 0 0
1 0 0 0 1
0 0 0 0 1
1 0 0 0 1
For this matrix, the distances in the x axis of the first point with respect to the others will be:
[0 4 2 0 4 4 0 4]
And the distances in the y axis will be:
[0 0 1 2 2 3 4 4]
Lets say that I cut this matrix in two parts, and I would have 2 matrices like this:
1 0 0 0 1
0 0 1 0 0
1 0 0 0 1
and
0 0 0 0 1
1 0 0 0 1
If I try to make the y-axis distances for the first matrix, they will be:
[0 0 1 2 2]
but for the next matrix will be:
[0 1 1], instead of what I had before [3 4 4]
Does anyone know how can I solve this issue? Thank you.
  댓글 수: 5
Image Analyst
Image Analyst 2014년 2월 17일
Why do you need it all in memory at once? Why can't you just concentrate on one pair at a time in a nested for loop?
Iain
Iain 2014년 2월 17일
For those of us not allowed to download stuff willy nilly from the net, can you define what "very big" means?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by