Why are the attached .mat files not matrices? What are these files?
2 views (last 30 days)
Show older comments
Justin Burzachiello
on 3 Jul 2021
Commented: Justin Burzachiello
on 4 Jul 2021
Hello. I recently went onto the following website to obtain matrices to use for descriptor state-space equations. https://morwiki.mpi-magdeburg.mpg.de/morwiki/index.php/RCL_Circuit_Equations I have also attached the data to this question.
However, I do not receive a matrix when I load them into MATLAB. I recieve a data structure that I am unfamiliar with:
As you can see at the right, the A data is just shown as a "val". Now, I do not understand what the val is telling me. I was expecting a 306x306 matrix, but I have 2*306 pairs, such as (134,1) and (230,1) for each value 1-306.
Does anyone know what this data is? How may I use it as a matrix?
- Thank you
0 Comments
Accepted Answer
Steven Lord
on 3 Jul 2021
A, B, and E are sparse matrices. Only the non-zero elements and the row and column indices of those non-zero elements are stored (and displayed.) So from your example, we know that element (134, 1) of A is 1. We also know that the first 133 rows of the first column of A contain 0. If they had a non-zero value they would have been displayed before element (134, 1).
If only a small percent of the elements in a matrix are non-zero storing those "boring" 0 values could consume a lot of memory and operating on them could consume a lot of time.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!