Replace Row in a Matrix with an Vector
51 ビュー (過去 30 日間)
古いコメントを表示
I have generated a matrix M with M = magic(5), and I was asked to creat a new matrix M_new, where M_new is M with its last row replaced by a row vector. I was required to use only one line of code, so no equal signs...
Original question:
M_new = %Matrix M, but the last row is replaced by vector Row
% Hint: This can be done in one line of code
0 件のコメント
回答 (2 件)
KALYAN ACHARJYA
2019 年 9 月 18 日
編集済み: KALYAN ACHARJYA
2019 年 9 月 18 日
Replace Row in a Matrix with an Vector
matrix(n,:)=vector_data
n is row number, Ensured that vector_data length and row length are same
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!