Vectorization dividing row by their maximum.
5 次查看(过去 30 天)
显示 更早的评论
*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 .*
0 个评论
采纳的回答
Star Strider
2015-4-18
This looks like it works:
M = magic(10);
m = max(M, [],2);
Result = bsxfun(@rdivide, M, m);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!