dividing each row by maximum value

14 views (last 30 days)
I have a matrix
A= [40.8 3 3.6 3.5 7.4
285 36.3 75 8.4 133
42 62 5 63 73
260 130 29 84 92
23 12 12 10 61
528 3179 320 3020 2314]
In this first i have to divide every element by the maximum value in that row for example ,the first row maximum value is 40.8 so the first row must be divided by 40.8
In the 2nd row the maximum value is 285 so every value in 2nd row must be divided by 285
as like i want to do for all rows please help

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 8 Aug 2012
out = bsxfun(@rdivide,A,max(A,[],2));

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!