tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
334 stars 97 forks source link

Needs Help on Reading Sparse Matrix from Mat file #82

Closed CharlieXu closed 6 years ago

CharlieXu commented 6 years ago

As far as I know, it is easy to read a double matrix from Mat file using matio. But, I am wondering How to read sparse matrix from a mat file ? Because my cases are saved in mat, some small matrices are saved in dense matrix, but some are in sparse due to the matrix size. Please help. all I can find the support of sparse begin with : matVar->class_type, what should I do next ?

Thanks in advance.

tbeu commented 6 years ago

what should I do next ?

Cast matVar->data to (mat_sparse_t*), check matVar->isComplex and have a look at Mat_VarPrint.

By the way, this is the issue tracker for developer and not meant for support. Better ask at the official Help Forum for support.

CharlieXu commented 6 years ago

Thanks for your reply t. I check the matio.h, the declare of and is different, is it safe to do that as you said "cast" (matvar_t) to (mat_sparse_t) ? I would like to know if the magic has been done while reading with ? logically, (mat_sparse_t) is after while creating (matvar_t) . or, I just use it without considering about the logic ?