multiplying row vector by a scalar
53 ビュー (過去 30 日間)
古いコメントを表示
trying to multiply the third row of a matrix by another row, B:
A = data(3, ;).*B
where B is a row vector
Need help finding a way to multiply the 3rd row of my matrix by a scalar value, for example 100.
Is there a way to do this all in one line?
Thanks!
0 件のコメント
回答 (4 件)
the cyclist
2023 年 2 月 23 日
% Your matrix
M = magic(4)
% Your scalar
scalar = 100;
% Multiply the third row of your matrix by your scalar
M(3,:) = scalar .* M(3,:)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!