sortnd
Sort the elements of an array along a particular direction.
` [y,ind]=sortnd(a,dim)`
 Inputs `a` Any array. `dim` An integer between `1` and the number of dimensions of `a` . Outputs `y` The sorted input along the diemnsion `dim` as defined below. `ind` The array of indices containing the information sufficient to reconstruct `y` from `a` .

Description
The result is such that the vector `y[i,j,k,..,:, p,q,..]` (where `i,j,..` are scalar integers, and `:` appears at the position indexed by `dim` ) is the sorted version of the vector `a[i,j,k,..,:, p,q,..]` .

The array of indices is such that with `M=ind[i,j,...,:, p,q,..]` , the vector `y[i,j,k,..,:, p,q,..]` is identical to the vector `a[i,j,k,..,M, p,q,..]` .

The call `shuffle(a,ind,dim)` can be used to reconstruct `y` from the other parameters.

Example
```>>a=fix(rand(2,4,3)*100)
>>a
[:,1:4, 1]
29           27           68           38
47           47           94           92
[:,1:4, 2]
40           96           52            9
6           70           73            1
[:,1:4, 3]
25           36           98           96
97           14           73           17

>>(b,ind)=sortnd(a,2)
>>// Note that the rows are sorted
>>b
[:,1:4, 1]
27           29           38           68
47           47           92           94
[:,1:4, 2]
9           40           52           96
1            6           70           73
[:,1:4, 3]
25           36           96           98
14           17           73           97

>>shuffle(a,ind,2)
[:,1:4, 1]
27           29           38           68
47           47           92           94
[:,1:4, 2]
9           40           52           96
1            6           70           73
[:,1:4, 3]
25           36           96           98
14           17           73           97

```