out of memory because of large matrixs and vectors
Show older comments
I have written a code which generate large vectors and matrices.
for example a 1*100000000 dimension matrix must generated during the main code, but "out-of-memory" error occurred.
how can I fix it?
Thank you in advance
2 Comments
James Tursa
on 16 Sep 2015
Edited: James Tursa
on 16 Sep 2015
A double vector of that size is 763MB. How much memory do you have? What do you get when you type the following at the command line:
memory
jafar
on 16 Sep 2015
Answers (1)
James Tursa
on 16 Sep 2015
Please show the code you are using to create these vectors and matrices. Are you sure you are not inadvertently attempting to create a large matrix instead of a vector? E.g.,
V = zeros(1,N); % <-- creates a 1 x N vector
M = zeros(N); <-- creates a N x N matrix
2 Comments
jafar
on 16 Sep 2015
James Tursa
on 16 Sep 2015
Edited: James Tursa
on 16 Sep 2015
D is a 321 GB array. So no, you can't allocate that much memory ... hence the error. You will need to reformulate your problem and maybe try to work it in pieces.
Categories
Find more on Matrices and Arrays 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!