MATLAB: Sum a value in a matrix

matrixsum

Hi!
How could I sum a value in a row of a Matrix? Imagine I have:
(0,0,0;0,0,0;0,0,0;0,0,0) and I would like to have (0,0,0;3,3,3;0,0,0;0,0,0)
How could I get this result?
Thank you

Best Answer

A = zeros(4,3) ;
A(2,:) = 3 ;