
Re: dumb matrix question
Posted:
Apr 26, 2011 8:34 AM


On 04/22/2011 04:54 AM, vjp2.at@at.BioStrategist.dot.dot.com wrote: > If I want to divide the elements of a row of a matrix by the sum of that row, > is there a simple MATRIX op (in MatLab) that will do this? > > >  =  > Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist > http://www.panix.com/~vjp2/vasos.htm > {Nothing herein constitutes advice. Everything fully disclaimed.} > [Homeland Security means private firearms not lazy obstructive guards] > [Urb sprawl confounds terror] [Phooey on GUI: Windows for subprime Bimbos] > > > >
Another two option can be:
(diag(sum(a'))\a)
or
(a'/diag(sum(a')))'
P.S. You can replace sum(a') with sum(a, 2) (which one is better depends on Matlab's internals).

