MATLAB provides a simple but efficient sum( ) function to sum column or row vector, as well as all elements in arrays.

Syntax: sum(v,options)

options can be 1 = sum in the row direction (NS) for each column

2 = sum in the column direction (EW) for each row

'all' = sum all elements

if unspecified, sum(v) = sum(v,1)

__ILLUSTRATION__