Vectorization dividing row by their maximum.

*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 日

0 投票

This looks like it works:
M = magic(10);
m = max(M, [],2);
Result = bsxfun(@rdivide, M, m);

1 件のコメント

Jameel Hassan
Jameel Hassan 2019 年 10 月 4 日
Why not just use
Result = M./m;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2015 年 4 月 18 日

コメント済み:

2019 年 10 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by