creating a new matrix from an obtained matix?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello. If I already have a matrix [1 2 3; 4 5 6; 7 8 9], how can I add 0 to its every row by a command?
Thank you.
0 件のコメント
回答 (2 件)
Alan Stevens
2020 年 8 月 15 日
Something like:
M = [1 2 3; 4 5 6; 7 8 9];
Mplus = [M zeros(3,1)]
Mplus =
1 2 3 0
4 5 6 0
7 8 9 0
Alwys assuming you want the zeros as the last column.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!