How to add names to table variables from a large cell with names?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a 600x1000 array (double), where Columns have data like this...
145.65 18.81 29.06 28.48 ...
145.66 18.73 29.10 28.52 ...
145.64 18.77 29.02 28.49 ...
...
145.82 17.59 29.27 28.94 ...
And have a 600 x 1 cell with Names like...
AAA_010
AAA_002
AAA_143
...
AAA 123
And I would like to end with a TABLE that has variable names based on the above cell with Names, like this...
AAA_010 AAA_002 AAA_143 ... AA123
145.65 145.66 145.64 ... 145.82
18.81 18.73 18.77 ... 17.59
29.06 29.10 29.02 ... 29.27
28.48 28.52 28.49 ... 28.94
... ... ... ... ...
Thanks for your suggestions!
0 件のコメント
採用された回答
dpb
2017 年 9 月 22 日
編集済み: dpb
2017 年 9 月 22 日
Looks peculiar orientation as doesn't keep the similarly-valued variables together, but per your request--
>> t=array2table(d.','variablenames',n)
t =
AAA_010 AAA_002 AAA_143 AAA_123
_______ _______ _______ _______
145.65 145.66 145.64 145.82
18.81 18.73 18.77 17.59
29.06 29.1 29.02 29.27
28.48 28.52 28.49 28.94
>>
Also, those names are going to be very difficult to use in being only distinguished by the trailing digits unless it is intended that names be automatically generated and/or the column positions are known. Of course, with 600 variables, having individual names/variables is going to be an issue in and of itself.
I'd suggest probably keeping the array structure and using the vector operations possible in Matlab will be more fruitful way to process your data but we're not given any indications of what intend to do next.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!