Borrar filtros
Borrar filtros

Replacing element in table

3 visualizaciones (últimos 30 días)
Sebastian Daneli
Sebastian Daneli el 15 de Nov. de 2021
Comentada: Sebastian Daneli el 15 de Nov. de 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.

Respuesta aceptada

Dave B
Dave B el 15 de Nov. de 2021
Editada: Dave B el 15 de Nov. de 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

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by