how to add anew column to the table using MATLAB
3 ビュー (過去 30 日間)
古いコメントを表示
I have Fatures data of 30*5 of size.I would like to add a column to the table as "class" and In that class every 10 rows has to named differently.First 10 rows as "Helathy' then 11 to 20 as "Myopathy" and 21 to 30 as "Neuropathy".
X=randi(10,30,5);
X=arry2table(X,'variableNames',{'feat1','feat2',feat3',feat4','feat5'};
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/930174/image.png)
Now I need to add a column to the table (values as taken as example) so the resultatnt must be
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/930179/image.png)
0 件のコメント
採用された回答
Stephen23
2022 年 3 月 17 日
M = randi(10,30,5);
T = array2table(M,'variableNames',{'feat1','feat2','feat3','feat4','feat5'})
T.Class = repelem(["Healthy";"Myopathy";"Neuropathy"],10,1)
0 件のコメント
その他の回答 (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!