Make arrays into a table
显示 更早的评论
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.

回答(2 个)
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)
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..
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
