How can I divide each row of a matrix by a fixed row?

Use bsxfun:

outMat = bsxfun (@rdivide, inMat, inMat(2,:));

The 1st argument to bsxfun is a handle to the function you want to apply, in this case right-division.

Leave a Comment