Convert table entries to vectors?
392 ビュー (過去 30 日間)
古いコメントを表示
So I have a table data with 9 entries (vectors with integers I presume, not really sure how data is stored in tables). To simplify my code I need entries/vectors 2-9 to be saved as separate columns in a matrix. I know I can do this manually newMatrix = [data.ent2 data.ent3 ... data.ent9] but I want to do it in a nicer/smoother way. Any tips on how I do this?
Many thanx!
0 件のコメント
採用された回答
KL
2017 年 9 月 26 日
編集済み: KL
2017 年 9 月 26 日
You should probably use table2array.
2 件のコメント
Peter Perkins
2017 年 9 月 27 日
table2array and Steve's suggestion of data.Variables are equivalent syntaxes. Since you only want some columns, another alternative would be
newMatrix = data{:,2:9}
その他の回答 (1 件)
Steven Lord
2017 年 9 月 26 日
If you want to combine all the variables in the table T into one array, and they can all be concatenated together, use T.Variables as listed on this documentation page.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!