Out of memory error for loop code
1 view (last 30 days)
Show older comments
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 Comments
Image Analyst
on 17 Feb 2014
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
on 17 Feb 2014
For those of us not allowed to download stuff willy nilly from the net, can you define what "very big" means?
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!