I have a very large Scipy sparse (csr) matrix. I can't use M.toarray()
since it triggers ValueError: array is too big.
Is there a way of saving a Scipy sparse matrix in Python to be read in Matlab? I need some tools that are available in Matlab.
Asked
Active
Viewed 1,580 times
2

Amro
- 123,847
- 25
- 243
- 454

user2179347
- 155
- 4
- 13
1 Answers
5
Scipy's Mat file format tools support sparse matrices:
from scipy import sparse, io
m = sparse.rand(50000,50000,density=1e-8)
io.savemat('dump.mat', dict(m=m))
And in matlab:
>> load dump

pv.
- 33,875
- 8
- 55
- 49