필터 지우기
필터 지우기

Fill a column in a table with an array

조회 수: 34 (최근 30일)
Gabi
Gabi 2022년 6월 29일
댓글: Voss 2022년 6월 29일
Hi,
I have a table T of a certain height and a 1x1 duration array, in this case, single value.
I would like to populate a new column in the given table T with the output value of the duration array over the height of T (in essence same value across all rows for the newly created column in T).
Thanks.

채택된 답변

Voss
Voss 2022년 6월 29일
편집: Voss 2022년 6월 29일
% a table T of a certain height:
T = table((1:10).',char((65:74).'))
T = 10×2 table
Var1 Var2 ____ ____ 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I 10 J
% a 1x1 duration array:
D = duration()
D = duration
00:00:00
% populate a new column in T with D:
T{:,'NewVar'} = D
T = 10×3 table
Var1 Var2 NewVar ____ ____ ________ 1 A 00:00:00 2 B 00:00:00 3 C 00:00:00 4 D 00:00:00 5 E 00:00:00 6 F 00:00:00 7 G 00:00:00 8 H 00:00:00 9 I 00:00:00 10 J 00:00:00
  댓글 수: 2
Gabi
Gabi 2022년 6월 29일
Thanks, it works as it should.
Voss
Voss 2022년 6월 29일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by