How to replace a column vector in matrix
96 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Danny Maefengea
el 28 de Ag. de 2020
Comentada: Phuwanut Pataratawinun
el 6 de Mzo. de 2022
A = [1 -4 1;4 -1 2;2 2 -3]
B = [6;-1;-20]
I want to replace part of matrx A i.e (1 -4 1) with B.
How can I do this?
Thank you for your help.
2 comentarios
Stephen23
el 28 de Ag. de 2020
"How can I do this? "
>> A = [1,-4,1;4,-1,2;2,2,-3]
A =
1 -4 1
4 -1 2
2 2 -3
>> B = [6;-1;-20];
>> A(1,:) = B
A =
6 -1 -20
4 -1 2
2 2 -3
kelly lim
el 3 de Dic. de 2021
how do you set the name of the new matrix , instead of A can you change it to Ax without changing the name of the original matrix. Please demosntrate thank you
Respuesta aceptada
Sara Boznik
el 28 de Ag. de 2020
A = [1 -4 1;4 -1 2;2 2 -3]
B = [6;-1;-20]
B=B'
A(1,:)=B'
4 comentarios
kelly lim
el 3 de Dic. de 2021
how do you set the name of the new matrix , instead of A can you change it to Ax without changing the name of the original matrix. Please demosntrate thank you
Phuwanut Pataratawinun
el 6 de Mzo. de 2022
If you want changed matrix Ax without changing matrix A, just copy the contents of matrix A over to a new matrix Ax, then do the same replacement.
A = [1 -4 1;4 -1 2;2 2 -3]
B = [6;-1;-20]
B = B'
Ax = A
Ax(1,:) = B'
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!