how can I multiplying matrix elements
4 次查看(过去 30 天)
显示 更早的评论
How can I multiple elements of one column or row of a matrix?
0 个评论
回答(1 个)
Image Analyst
2012-11-5
% Multiply a row by some number.
theRow = 42; % or whatever.
myMatrix(theRow, :) = someNumber * myMatrix(theRow, :);
% Multiply a column by some number.
theColumn = 13; % or whatever.
myMatrix(:, theColumn) = someNumber * myMatrix(:, theColumn);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!