How to replace a column vector in matrix

316 views (last 30 days)
Danny Maefengea
Danny Maefengea on 28 Aug 2020
Commented: kelly lim on 3 Dec 2021 at 3:07
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 Comments
kelly lim
kelly lim on 3 Dec 2021 at 3:06
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

Sign in to comment.

Accepted Answer

Sara Boznik
Sara Boznik on 28 Aug 2020
A = [1 -4 1;4 -1 2;2 2 -3]
B = [6;-1;-20]
B=B'
A(1,:)=B'
  3 Comments
kelly lim
kelly lim on 3 Dec 2021 at 3:07
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

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by