MATLAB: Sum elements of matrix aside from the first row or column

sum

I have a matrix
A=rand(10,40401);
How can i sum the elements of the matrix excluding
1.the first row only
2. the first column only.
Thanks.

Best Answer

A=rand(3,2) % a short example for you to understand
a=A(2:end,:) % excludes first row
b=A(:,2:end) % excludes first column
a1=sum(a,1) % sum across rows
%or
a2=sum(a,2) % sum across columns
%same for b
Gives:
A =
0.4037 0.2671
0.1224 0.2462
0.3660 0.3607
a =
0.1224 0.2462
0.3660 0.3607
b =
0.2671
0.2462
0.3607
a1 =
0.4884 0.6069
a2 =
0.3686
0.7268