MATLAB: How to sum the elements of each corner of a matrix

matrix

If I have a 4×4 matrix, how do i sum 4 elements in 4 corner of that matrix
for example my matrix will be : A=[1 2 3 4; 5 6 7 8 9;10 11 12 13; 14 15 16 17]
Thanks you so much

Best Answer

iwant = A(1,1)+A(1,end)+A(end,1)+A(end,end)