Try findnz. This seems to not be documented in the sparse section of the manual, but I would think it should be.
— John On Sep 18, 2014, at 6:58 PM, DumpsterDoofus <peter.richter....@gmail.com> wrote: > Given column vectors I, J, and V, one can construct a sparse matrix using the > following syntax: > > sparse(I, J, V) > > How about the reverse? I.e., given a sparse matrix S, is there a function > which returns the column vectors I, J, and V that define S? > > One can obtain the list of nonzero values V with the command > > nonzeros(S) > > but I'm not sure how to get the row and column coordinates I and J that go > along with V. Is there a convenient way to obtain I and J?