Why do I receive an an "out of memory" error when I resize a sparse matrix in a MEX file in MATLAB?

1 view (last 30 days)
Why do I receive an "out of memory" error when I resize a sparse matrix in a MEX-file in MATLAB?
I wrote a MEX-file that handles sparse matrices correctly. When the DLL returns the output data to the MATLAB workspace, the matrix is correct. I use the FIND function on this output matrix and can read out columns and rows. However, if the matrix contains less non-zero values, I get an OUT OF MEMORY error.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The problem appears to occur when you incorrectly size the JC field of a sparse matrix. This field must be size N+1, where N is the length of the number of columns of the sparse matrix.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!