Difference between revisions of "ConcatRows"

m (adding doc status category)
Line 2: Line 2:
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
  
= ConcatRows( A : Array[I,J] ; I,J,K : Index ) =
+
= ConcatRows( A ; rowIndex,colIndex, '',concatIndex'' ) =
  
Takes an array, ''A'' indexed by ''I'' and ''J'', and concatenates each row, henceforth flattening the array by one dimension. The result is indexed by ResultIndex, which must be an index with [[size]](I) * [[size]](J) elements.
+
Takes an array, ''A'' indexed by ''rowIndex'' and ''colIndex'', and concatenates each row, henceforth flattening the array by one dimension. The result is indexed by ''concatIndex'', which must be an index with ''[[Size]](rowIndex) * [[Size]](colIndex) elements
 +
 
 +
As of ''Analytica 4.2'', ''concatIndex'' is optional.  If not specified, [[ConcatRows]] creates a local index with the name .ConcatIndex to dimension the result.
  
 
= Library =
 
= Library =
  
Concatenation.ana
+
In Analytica 4.2 and later, this function is a built-in function, in the Array library.
 +
 
 +
In Analytica 4.0 and 4.1, this function is located in the "Concatenation.ana" library.  To use that function, you must add the library to your model.
 +
 
 +
= Examples =
 +
 
 +
Let
 +
{|border="0"
 +
! &nbsp;&nbsp;&nbsp; !! A:= ||
 +
{|border="1"
 +
!rowspan="2" colspan="2" |
 +
! colspan="4" | J
 +
|-
 +
! 1 !! 2 !! 3 !! 4
 +
|-
 +
! rowspan="2" | J
 +
! 1 || 'a' || 'b' || 'c' || 'd'
 +
|-
 +
! 2 || 'e' || 'f' || 'g' || 'h'
 +
|}
 +
|}
 +
 
 +
{|border="0"
 +
| [[ConcatRows]](A,I,J) || &rarr; ||
 +
{| border="1"
 +
! .ConcatIndex: !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7 !! 8
 +
|-
 +
! || 'a' || 'b' || 'c' || 'd' || 'e' || 'f' || 'g' || 'h'
 +
|}
 +
|}
 +
 
 +
{|border="0"
 +
| [[ConcatRows]](A,J,I) || &rarr; ||
 +
{| border="1"
 +
! .ConcatIndex: !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7 !! 8
 +
|-
 +
! || 'a' || 'e' || 'b' || 'f' || 'c' || 'g' || 'd' || 'h'
 +
|}
 +
|}
  
(to use this function, you must add the library to your model)
+
To flatten three dimensions, I1, I2 and I3, use:
 +
:[[Var..Do|Var]] tmp := [[ConcatRows]](A,I1,I2) Do [[ConcatRows]](tmp,tmp.ConcatIndex,I3)
  
 
= See Also =
 
= See Also =

Revision as of 19:06, 14 November 2008


ConcatRows( A ; rowIndex,colIndex, ,concatIndex )

Takes an array, A indexed by rowIndex and colIndex, and concatenates each row, henceforth flattening the array by one dimension. The result is indexed by concatIndex, which must be an index with Size(rowIndex) * Size(colIndex) elements.

As of Analytica 4.2, concatIndex is optional. If not specified, ConcatRows creates a local index with the name .ConcatIndex to dimension the result.

Library

In Analytica 4.2 and later, this function is a built-in function, in the Array library.

In Analytica 4.0 and 4.1, this function is located in the "Concatenation.ana" library. To use that function, you must add the library to your model.

Examples

Let

    A:=
J
1 2 3 4
J 1 'a' 'b' 'c' 'd'
2 'e' 'f' 'g' 'h'
ConcatRows(A,I,J)
.ConcatIndex: 1 2 3 4 5 6 7 8
'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h'
ConcatRows(A,J,I)
.ConcatIndex: 1 2 3 4 5 6 7 8
'a' 'e' 'b' 'f' 'c' 'g' 'd' 'h'

To flatten three dimensions, I1, I2 and I3, use:

Var tmp := ConcatRows(A,I1,I2) Do ConcatRows(tmp,tmp.ConcatIndex,I3)

See Also

Comments


You are not allowed to post comments.