MATLAB: Matlab row subtraction of matrix

matrix manipulation

Matlab subtractions of rows of matrix(eg:- row2-row1) and then how to rewrite the resulatant entire matrix where 2nd row = row2 – row1

Best Answer

On the other hand, maybe you want to subtract row 2 from all the rows. In that case, you can do this.
>> A
A =
1 2 3 4
11 12 13 14
22 23 24 25
42 43 44 45
>> AsubRow2 = A - A(2,:)
AsubRow2 =
-10 -10 -10 -10
0 0 0 0
11 11 11 11
31 31 31 31