Create a matrix from column vectors with necessary data
6 views (last 30 days)
Show older comments
I have the table with 3 column vectors in total 4367 rows. In the first column there are repetitive ids related to the specific indusrty, in the second column repetive ids for the commodities which can be produced. Third column containes dollar values of produced commodities by specific industry. I want to create matrix with unique industry ids(491 in total) as a rows and commodity ids (480 in total) as a columns, but I have no idea how to perform this operation in Matlab. One industry can produce more than one commodity Thank you in advance.
The part of the file to get an idea.
"1111A0","1111A0",19748.80
"1111A0","115000",353.00
"1111A0","230220",7.00
"1111A0","713A00",148.00
"1111B0","1111B0",37540.50
"1111B0","115000",695.00
"1111B0","230220",16.00
"1111B0","713A00",281.00
"111200","111200",14356.10
"111200","115000",81.00
"111200","713A00",32.00
"111335","111335",2157.20
"111335","115000",29.00
"111335","713A00",14.00
0 Comments
Answers (1)
Image Analyst
on 30 Apr 2017
The output "matrix" you want would have to be a cell array. Use table2cell() to convert your table to a cell array:
C = table2cell(T) converts the table, T, to a cell array, C.
Each variable in T becomes a column of cells in C.
Frankly, I'd leave it as a table if I were you. They're much easier to deal with.
0 Comments
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!