How to add names to table variables from a large cell with names?

조회 수: 2 (최근 30일)
Robert
Robert 2017년 9월 22일
댓글: Robert 2017년 9월 22일
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!

채택된 답변

dpb
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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by