Can I convert CRS and CSC sparse matrices to MATLAB sparse matrices?

5 Ansichten (letzte 30 Tage)
I have data stored in the CRS and CSC formats in MATLAB arrays, and I want to use them as "sparse" matrices in MATLAB with the sparse matrix operations.
How can I convert from CRS and CSC to MATLAB sparse matrices? I understand that internally MATLAB stores sparse matrices in the CSC format. To access the specific details of how MATLAB handles sparse matrices, please execute the following command in the MATLAB R2020a command window to view the relevant documentation:
>> web(fullfile(docroot, 'matlab/ref/sparse.html'))

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 17 Jan. 2025
Bearbeitet: MathWorks Support Team am 3 Feb. 2025
Unfortunately at this time, the only way to create MATLAB sparse matrices is with 1-indexed, [row, column, vector] triplets, which are not how CRS and CSC are formatted.
Once you have the data in this accepted format, you can use the (row, column, value) vectors as input to the "spconvert" and "sparse" MATLAB functions. To access the documentation for these functions in MATLAB R2020a, execute the following command in the command window:
>> web(fullfile(docroot, 'matlab/ref/spconvert.html'))
Similarly, for the "sparse" function documentation, use this command in MATLAB R2020a:
>> web(fullfile(docroot, 'matlab/ref/sparse.html'))
For information on the current release, please visit the following link to search for the required details:

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by