How can I pre allocate the memory for a variable? or is it possible?
Ältere Kommentare anzeigen
Assume that I have a variable "Sis" and it will be used as sparse matrix. and non zero elements will be set in the following loops. The problem is if you don't allocate the memory before you use, it takes really long time to create a matrix of (2.000.000, 250.000);
İs there a way to doing that
Sis 33489x5625 3970464 double sparse
Sis_2 33489x5625 1507005000 double
Here is an example to show why I need sparse matrix.
Thanks
Akzeptierte Antwort
Weitere Antworten (2)
Iain
am 26 Feb. 2014
lf you want is to preallocate a sparse array, all you need is:
Sis = sparse(2000000, 250000);
If you look at the help documentation for the sparse function, you might be able to find a better way of doing what you're trying to do.
1 Kommentar
Metin Ertas
am 26 Feb. 2014
Kategorien
Mehr zu Sparse Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!