How to replace a column vector in matrix
245 ビュー (過去 30 日間)
古いコメントを表示
Danny Maefengea
2020 年 8 月 28 日
コメント済み: Phuwanut Pataratawinun
2022 年 3 月 6 日
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 件のコメント
Stephen23
2020 年 8 月 28 日
"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
2021 年 12 月 3 日
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
採用された回答
Sara Boznik
2020 年 8 月 28 日
A = [1 -4 1;4 -1 2;2 2 -3]
B = [6;-1;-20]
B=B'
A(1,:)=B'
4 件のコメント
kelly lim
2021 年 12 月 3 日
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
2022 年 3 月 6 日
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'
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!