How to generate repeat column labels
3 ビュー (過去 30 日間)
古いコメントを表示
Hi
I'm looking to create column labels for my table:
array2table(data,'VariableNames',{'FirstName' 'Height' 'Weight' 'BloodPressure'})
I want the variable names to be Cell 1, Cell 2, Cell 3, Cell 4, etc. until Cell 100. How can I generate these repeat character strings without typing it out manually? Thanks.
0 件のコメント
採用された回答
その他の回答 (1 件)
Atsushi Ueno
2022 年 5 月 21 日
text = sprintf('Cell %d\n',1:100);
text(end) = []; % to avoid an empty cell at the end
labels = splitlines(text);
array2table(1:100,'VariableNames',labels)
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!