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!