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!