sum
sum of the elements of an array along a specified dimension.
`(y)=sum(x)`
`(y)=sum(x, dim)`
 Inputs `x` Any numeric array. `dim` A positive integer not greater than the number of dimensions of `x` . Outputs `y` The array of sum of the elements of `x` along the dimension `dim` whose default value is `1` .

Description
If `x` is a vector, the output is the sum of all the elements of the vector. Otherwise the output is of the same size as the input except that along the dimension `dim` the size of the output is `1` . The element `y[i,j,k,...1, p, q,..]` (with `1` corresponding to the dimension `dim` ) of the output is the sum of the elements of the vector `x[i,j,k,....,:,p,q,...]` where `i, j, k, ...,p,q,...` are scalar integers ranging through the size of the input along the corresponding dimension.
Example
```>>a=floor(randn(3,4,2)*100)
>>a
[:,1:4, 1]
-125          -21          -32          -30
-29          166          -12          -69
-22          -38           24          105
[:,1:4, 2]
93           45         -187           48
-108          -63          -63            3
26          144         -137           69

>>sum(a)
[:,1:4, 1]
-176          107          -20            6
[:,1:4, 2]
11          126         -387          120

>>sum(a,3)
[:,1:4, 1]
-32           24         -219           18
-137          103          -75          -66
4          106         -113          174

```