필터 지우기
필터 지우기

Replacing element in table

조회 수: 2 (최근 30일)
Sebastian Daneli
Sebastian Daneli 2021년 11월 15일
댓글: Sebastian Daneli 2021년 11월 15일
I have this table
X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=[3 1; 8 9];
X=table(X1,X2,X3)
X = 2×3 table
X1 X2 X3 ___________ ______ ______ 9 6 9 0 2 3 1 3 2 7 4 0 8 9
How do I replace X3 with X1 so that i get
X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=X1;
X=table(X1,X2,X3)
X = 2×3 table
X1 X2 X3 ___________ ______ ___________ 9 6 9 0 2 9 6 9 3 2 7 4 0 3 2 7
Without having to make an new table that is.

채택된 답변

Dave B
Dave B 2021년 11월 15일
편집: Dave B 2021년 11월 15일
You can do point to table variables with the syntax tablename.variablename:
X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=[3 1; 8 9];
X=table(X1,X2,X3)
X = 2×3 table
X1 X2 X3 ___________ ______ ______ 9 6 9 0 2 3 1 3 2 7 4 0 8 9
X.X3=X1 % or X.X3=X.X1 in this case
X = 2×3 table
X1 X2 X3 ___________ ______ ___________ 9 6 9 0 2 9 6 9 3 2 7 4 0 3 2 7
  댓글 수: 1
Sebastian Daneli
Sebastian Daneli 2021년 11월 15일
That was effective. Than you.

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

추가 답변 (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