Difference between revisions of "Flatten"
(fixed category) |
|||
Line 2: | Line 2: | ||
''new to [[Analytica 4.7]]'' | ''new to [[Analytica 4.7]]'' | ||
− | == Flatten( x'', I..., resultIndex'' ) == | + | == Flatten(x'', I..., resultIndex'') == |
Flattens the cells of a multi-dimensional array into a one-dimensional vector. | 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, <code> | + | You should usually specify the indexes of «x» that you want to flatten over. For example, <code>Flatten(x, In1, In2, In3)</code> 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, <code>K</code> for the final result, specify it by name using | If you already have a result index, <code>K</code> for the final result, specify it by name using | ||
− | :<code> | + | :<code>Flatten(x, In1, In2, In3, resultIndex: K)</code> |
− | |||
− | Because a local index is created for the result, to define an index from the result of [[Flatten]], you should surround it in <code> | + | If you omit «resultIndex», a local index is created for you with the name <code>.K</code>. 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 <code>CopyIndex(...)</code>. | ||
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. | 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. | ||
Line 19: | Line 20: | ||
TBD | TBD | ||
+ | |||
+ | ==History== | ||
+ | * Introduced in [[Analytica 4.7]]. | ||
== See Also == | == See Also == | ||
− | |||
* [[Unflatten]] | * [[Unflatten]] | ||
+ | * [[Local Indexes]] | ||
* [[ConcatRows]]( ) -- note: [[Flatten]] and [[ConcatRows]] are nearly identical in functionality when applied to a 2-D array «x». | * [[ConcatRows]]( ) -- note: [[Flatten]] and [[ConcatRows]] are nearly identical in functionality when applied to a 2-D array «x». | ||
− | * [[MdArrayToTable]]( ) -- | + | * [[MdArrayToTable]]( ) -- also unflattens, but unlike [[Flatten]], [[MdArrayToTable]] includes the coordinates of each cell in the result. |
Revision as of 18:49, 23 March 2016
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