Flatten
new to Analytica 4.7
Flatten(x, I..., resultIndex)
Flattens the cells of a multi-dimensional array into a one-dimensional vector.
You should usually specify the indexes of «x» that you want to flatten over. For example, Flatten(x, In1, In2, In3)
returns a one-dimensional array having the same values as the 3-dimensional array «x». The indexes listed first vary the slowest.
If you already have a result index, K
for the final result, specify it by name using
Flatten(x, In1, In2, In3, resultIndex: K)
If you omit «resultIndex», a local index is created for you with the name .K
. If your «resultIndex» is shorter than the number of cells, the flattened result is truncated, or if it is too long the result is null-padded.
Because a local index is created for the result, to define an index from the result of Flatten, you should surround it in CopyIndex(...)
.
If you omit «I» (the indexes to flatten), then all indexes of «x» are used, but you don't have explicit control over what order is used.
Examples
TBD
History
- Introduced in Analytica 4.7.
See Also
- Unflatten
- Local Indexes
- ConcatRows( ) -- note: Flatten and ConcatRows are nearly identical in functionality when applied to a 2-D array «x».
- MdArrayToTable( ) -- also unflattens, but unlike Flatten, MdArrayToTable includes the coordinates of each cell in the result.
Enable comment auto-refresher