MATLAB: How to sum part of a column

sum parts of a column

Hi. I am new to Matlab.
Does anybody know how I can calculate the column sum of row 1 and 2 in column 3 in the follwoing matrix (3+6)?
1 2 3
4 5 6
7 8 9

Best Answer

If your matrix is called A, then rows 1 and 2 in column 3 can be identified with the syntax
A( 1:2, 3 )
So sum it using the command
sum( A( 1:2, 3 ) )