Is there an easy way to divide each matrix element by the column sum? For example:
input: 1 4 4 10 output: 1/5 4/14 4/5 10/14
a=[1 4;4 10] a = 1 4 4 10 a*diag(1./sum(a,1)) ans = 0.2000 0.2857 0.8000 0.7143