Doing arithmatic to specific rows of a matrix

1 回表示 (過去 30 日間)
Connor
Connor 2023 年 2 月 5 日
コメント済み: Connor 2023 年 2 月 5 日
I have this matrix in part a) called Mat1 and for part c) I need to do different arithmatic opertations to individual rows. How would I go about doing this? I can only seem to do it for the whole matrix.

採用された回答

Voss
Voss 2023 年 2 月 5 日
編集済み: Voss 2023 年 2 月 5 日
Here's an example that adds 6 to the second row of a matrix M:
% define M
M = [1 2 3; 4 5 6; 7 8 9]
M = 3×3
1 2 3 4 5 6 7 8 9
% add 6 to the second row of M
M(2,:) = M(2,:) + 6
M = 3×3
1 2 3 10 11 12 7 8 9
  1 件のコメント
Connor
Connor 2023 年 2 月 5 日
Thank you for the help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by