How can I save a very large MATLAB sparse matrix to a text file?

前端 未结 8 721
孤城傲影
孤城傲影 2021-02-01 06:53

I have a 30000x14000 sparse matrix in MATLAB (version 7), which I need to use in another program. Calling save won\'t write this as ASCII (not supported). Calling full()

相关标签:
8条回答
  • 2021-02-01 07:53

    Use this script: msm_to_mm.m, writes an MATLAB sparse matrix to an MatrixMarket file.

    And This thread may also be useful.

    0 讨论(0)
  • 2021-02-01 07:57

    If this is pretty much a one time deal, then I would just iterate through the matrix and write the matrix to an ASCII file by brute force, or else use @Veynom's suggestion and call full() on a subset of rows. It may take a while, but it will probably be done faster than it might take to learn how to read in a .mat file outside of the MATLAB environment.

    If this is something you need to do on a recurring basis, then I would take @Vebjorn's advice and use a library to read the .mat file.

    0 讨论(0)
提交回复
热议问题