MATLAB: How to add a row matrix to all other rows of a matrix

addbigeveryforfor loophowMATLABmatrixmatrix arrayofoperationrowtovector

In order to get the right values in my final matrix, I have to add a single column matrix (with the same amount of rows) to a bigger matrix. It's important that both matrices can be declared and initialized before adding them together. Basically, I already did this while using a simple for loop, but it's very time consuming for MATLAB to do this operation for every column (20.000 to 900.000 columns). I was wondering if there was a simpler/faster way to become the same result as the code snippet:
for a = 1:size(VarLasten,2)
VarLasten(:,a) = VarLasten(:,a) + Perm;
end
With VarLasten = the final matrix where every initial row is added with the corresponding value of the row matrix Perm. VarLasten = (m x n) and Perm = (m x 1).

Best Answer

Why not use simple concatenation? First transpose the row-vector into a m-by-1 column vector, of course:
NewVarLasten = [VarLasten Perm(:)]