Vectorization dividing row by their maximum.

조회 수: 4 (최근 30일)
Aravin
Aravin 2015년 4월 18일
댓글: Jameel Hassan 2019년 10월 4일
*Dear All,
Let say I have M = magic(10); Now I want to divide each element of the matrix by the maximum element row wise.
For example, I can get max in rows by
m = max(M, [],2);
Now this is column matrix having same number of rows as M. Now I want to divide each row of M by the row value of m .*

채택된 답변

Star Strider
Star Strider 2015년 4월 18일
This looks like it works:
M = magic(10);
m = max(M, [],2);
Result = bsxfun(@rdivide, M, m);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by