필터 지우기
필터 지우기

Make arrays into a table

조회 수: 5 (최근 30일)
TOK
TOK 2021년 9월 3일
답변: Peter Perkins 2022년 3월 2일
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개)

Chunru
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)
T = 10×3 table
a1 a2 a3 ________ _______ ________ 0.019949 0.95707 0.72243 0.034856 0.37661 0.028956 0.055403 0.27985 0.43342 0.7962 0.20116 0.36953 0.61853 0.41453 0.95966 0.14751 0.29902 0.60573 0.23709 0.94669 0.016313 0.76907 0.69757 0.70434 0.54518 0.43477 0.2681 0.13691 0.83177 0.14211
plot(T.a1)
  댓글 수: 4
TOK
TOK 2021년 9월 3일
I've just tried your solution with my arrays and It just shows me the headings an says "1x12 double" instead of listing the 12 data points.
Chunru
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
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..

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by