S = sum (___ , type ) returns
an array in the class specified by type, using
any of the input arguments in the previous syntaxes. type can
be 'double' or 'native'.

If type is 'double',
then sum returns a double-precision array, regardless
of the input data type.

If type is 'native',
then sum returns an array with the same class of
input array A.

The fimath object is used in the calculation
of the sum. If SumMode is FullPrecision, KeepLSB,
or KeepMSB, then the number of integer bits of
growth for sum(A) is ceil(log2(size(A,dim))).

sum does not support fi objects
of data type Boolean.

Create a fi array, and compute
the sum of the elements in each column.

A=fi([1 2 8;3 7 0;1 2 2])

A =
1 2 8
3 7 0
1 2 2
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 11

S=sum(A)

S =
5 11 10
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 18
FractionLength: 11

MATLAB^{®} returns a row vector with the sums of each column
of A. The WordLength of S has
increased by two bits because ceil(log2(size(A,1)))=2.
The FractionLength remains the same because the
default setting of SumMode is FullPrecision.

Dimension to operate along, specified as a positive integer
scalar. dim can also be a fi object.
If no value is specified, the default is the first array dimension
whose size does not equal 1.