Make arrays into a table
5 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have 6 arrays of equal length, each representing a certain parameter and each slot in the array represents the value of the parameters
I would like to tabulate the data so that I can scroll through and see all the data at once. How may I do this?
The image below is what I am looking for, ideally where I can specify a label in the left most column.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/728169/image.png)
0 件のコメント
回答 (2 件)
Chunru
2021 年 9 月 3 日
編集済み: Chunru
2021 年 9 月 3 日
It's better to organize the table in transposed order.
a1 = rand(10, 1);
a2 = rand(10, 1);
a3 = rand(10, 1);
T = table(a1, a2, a3)
plot(T.a1)
4 件のコメント
Chunru
2021 年 9 月 4 日
In that case, you may need to transpose your data first before forming the table. See the size of the variables a, b, c.
Peter Perkins
2022 年 3 月 2 日
TOK, you have 6 series, each with length 10. The normal way to orient that would be 10 rows, 6 columns. Nonetheless,
>> a1 = rand(1,10);
>> a2 = rand(1,10);
>> a3 = rand(1,10);
>> T = array2table([a1;a2;a3])
T =
3×10 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10
_______ ________ _______ ________ ________ _______ _______ _______ _______ ________
0.70605 0.031833 0.27692 0.046171 0.097132 0.82346 0.69483 0.3171 0.95022 0.034446
0.43874 0.38156 0.76552 0.7952 0.18687 0.48976 0.44559 0.64631 0.70936 0.75469
0.27603 0.6797 0.6551 0.16261 0.119 0.49836 0.95974 0.34039 0.58527 0.22381
But if you want to plot each series as one line, that's the wrong orientation to use, as Chunru showed..
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!