Re: matrix operation



Johannes Deelstra wrote:


Hello,
How to solve the following problem?
I have a 12 x 12 matrix. I want each element in the respective
columns to be divided by the sum of that specific column. So, for
the
first column in a matrix A, element A(1,1)) has to be divided by
sum(A(:,1),1), A(1,2)/sum(A(:,1),1), etc.
How do I carry out this operation? How do I shortwrite this?
Regards
Johannes

A = A./repmat(sum(A,1),size(A,1),1);

HTH,
John
.