Can I convert CRS and CSC sparse matrices to MATLAB sparse matrices?
5 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-5-14
编辑: MathWorks Support Team
2025-2-3
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'))
采纳的回答
MathWorks Support Team
2025-1-17
编辑:MathWorks Support Team
2025-2-3
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:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!