For quick and dirty, I'd set the memoryuse / vmemoryuse to "unlimited" and see what happens.
(weird) Out Of Memory Error
1 次查看(过去 30 天)
显示 更早的评论
Dear all, I'm experiencing a weird out of memory error that can't really understand.
I have a few big 3D matrices A,B,X and a 3D vector N. I use A,B and N to fill X (one row at a time) doing something like: (X is preallocated to all zeroes)
X(i,:,k)= (A(i,:,k).*B(i,:,k))/N(i,1,k);
This causes some OUT OF MEMORY error, which might be fine.
What bothers me is that, when debugging, if I try to assign the right end to a NEW variable "p" then there is no problem.
That is if I write:
p = (A(i,:,k).*B(i,:,k))/N(i,1,k);
p is created and the values are assigned correctly.
However if I try to assign p to the row of X then the same issue appears:
X(i,:,k)=p; % this causes an OUT OF MEMORY ERROR
Now, this doesn't make sense to me. In theory the memory for X has already been allocated. Why the creation of a new (additional) vector doesn't cause an OUT OF MEMORY ERROR, while the assignment of a vector into an already existing Matrix causes does?
What can I do to overcome this? Before trying the assignment, only 20% of my memory is used by MATLAB (according to TOP), so I guess that should be more than enough.
I'have already increased the available memory for Matlab and followed (I think correctly) the advices provided in the MATLAB help. I'd like to find a fast "quick and dirty" solution to overcome this issue, that else would require rewriting a significant portion of code.
Thanks a lot for your help, Cheers, Luca
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!