Create vectors from a table
6 ビュー (過去 30 日間)
古いコメントを表示
Attached is a sample of a large table. I want to create a vector for each column in thetable (i.e 2891 vectors) where the name of each vector is the header of the column in the table (e.g., create a vector called RSSD9999 which is column 1 in the table , another RSSD9001 which is column 2 in the table). how can I do this since manually it takes a lot of time and the size of table and the name of vectors is changing across files.
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 11 月 21 日
We recommend against that firmly.
Already, a table acts like a struct for the purpose of dynamic field name access.
V = 'RCON8697';
sample.(V)
and if you do not need to work with the names dynamically then you can just access by field name.
sample.RCON8697
You could also use table2struct() to move directly to struct form, if that is helpful.
fieldnames() can be applied to a table, but it does return the extra names 'Properties', 'Row', and 'Variables' beyond the variable names.
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!