Replacing element in table

3 Ansichten (letzte 30 Tage)
Sebastian Daneli
Sebastian Daneli am 15 Nov. 2021
Kommentiert: Sebastian Daneli am 15 Nov. 2021
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.

Akzeptierte Antwort

Dave B
Dave B am 15 Nov. 2021
Bearbeitet: Dave B am 15 Nov. 2021
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

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by