Copy table's certain data into another table with corresponding variable names
103 ビュー (過去 30 日間)
古いコメントを表示
Let's say I have a table with 10 rows and 10 columns. I'd like to copy 5 cols and 10 rows of the table into another one with their variable names. Is there a way to do that?
Thank you.
0 件のコメント
採用された回答
Mohammad Abouali
2014 年 10 月 22 日
Lets say you want move column Age from table1 to table2
table2.Age=table1.Age
Or if you want to move column 5 to 8 of table1 to table2 do this:
for c=5:8
table2.(T.Properties.VariableNames{c})=table1.(T.Properties.VariableNames{c});
end
2 件のコメント
Mohammad Abouali
2014 年 10 月 23 日
編集済み: Mohammad Abouali
2014 年 10 月 23 日
Do your two tables have the same number of rows?
By the way, I have assumed that both table2 and table1 are already defined.
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!