flatten

Distribute elements of 2d matrix across 1d array.

flatten name <output set name> [mode {sum|avg}] <input set args>

name <output set name> Name of flattened1D output set(s).
mode {sum|avg} If sum, matrix elements will be summed. If avg, matrix elements will be averaged.
<input set args> Specify matrices to flatten. DataSets Created
<output set name> Flattened 1D set if only one input matrix.
<output set name>:<idx> Flattened 1D sets when more than one input matrix; index starts from 1.

Flatten 1 or more matrices into 1D array(s) by summing or averaging elements.
For example, given a matrix with values like this:

X Y Value 
1 3 5.0 
1 4 4.0 
2 3 2.0

The flattened 1D array with mode SUM would be determined as follows:

Element 1 = (5.0/2) + (4.0/2) = 4.5 
Element 2 = (2.0/2) = 1.0 
Element 3 = (5.0/2) + (2.0/2) = 3.5 
Element 4 = (4.0/2) = 2.0

And the final 1D array would look like so:

Index Value 
1 4.5 
2 1.0
3 3.5 
4 2.0