Operations with tables and matrix
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have three tables with some information and I want to finally obtain a 3D-matrix:
The 3 tables are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167711/image.jpeg)
First step: I want to include information from table2 in table 1
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167712/image.jpeg)
Second step: I want to create a 3D-matrix with information from new_table1 and table 3
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167713/image.jpeg)
Any suggestions?
Thank you!
Montse
0 个评论
回答(1 个)
Akira Agata
2017-12-16
I'm not sure why you want to make 3D matrix. By connecting all the tables using innerjoin, you can obtain a table which contains all the information you need, like:
table12 = innerjoin(table1,table2,'Keys','date');
table123 = innerjoin(table12,table3,'Keys','ind');
tableOut = table123(:,{'ind','dur','vm','value1','value2','value3'});
If you want to make 3D matrix for some reason, it's a piece of cake!
data3D = cat(3,tableOut{:,{'ind','dur','vm','value1'}},...
tableOut{:,{'ind','dur','vm','value2'}},...
tableOut{:,{'ind','dur','vm','value3'}});
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stability Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!