Difference between revisions of "MdArrayToTable"

 
(Copy/pasted from user guide)
Line 1: Line 1:
[[category:Array Functions]]
+
[[category:Array Flattening Functions]]
 +
 
 +
= MdArrayToTable(A,I,L) =
 +
 
 +
Transforms a multi-dimensional array, ''A'', into a two-dimensional
 +
array (i.e., a table) indexed by ''I'' and ''L''. The result contains one
 +
row along ''I'' for each element of ''A''. ''L'' must contain a list of names
 +
of the indexes of ''A'', followed by one final element. All elements of
 +
L must be text values. The column corresponding to the final element
 +
of ''L'' contains the cell value. If L does not contain all the
 +
indexes of ''A'', array abstraction will create a set of tables indexed
 +
by the dimensions not listed in ''L''.
 +
 
 +
Transforms a multi-dimensional array, ''A'', into a two-dimensional
 +
array (i.e., a table) indexed by ''I'' and ''L''. The result contains one
 +
row along ''I'' for each element of ''A''. ''L'' must contain a list of names
 +
of the indexes of ''A'', followed by one final element. All elements of
 +
''L'' must be text values. The column corresponding to the final element
 +
of ''L'' contains the cell value. If ''L'' does not contain all the
 +
indexes of ''A'', array abstraction will create a set of tables indexed
 +
by the dimensions not listed in ''L''.
 +
 
 +
If the number of elements in ''I'' is equal to the number of nonzero
 +
elements of ''A'', '''''MDArrayToTable()''''' acts like the inverse of
 +
[[MDTable]]( ) on a table that contains a row for only the nonzero
 +
elements of the array.
 +
 
 +
= Library =
 +
 
 +
Array
 +
 
 +
= Example =
 +
 
 +
Rows := sequence(1,size(Cost_in_time))
 +
Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
 +
 
 +
MDArrayToTable(Cost_in_time,Rows,Cols) →
 +
{| border="1"
 +
|+ Rows v, Cols >>
 +
Mpg Time Car_type Cost
 +
|-
 +
!1 ||26 ||0 ||VW ||2185
 +
|-
 +
!2 ||26 ||0 ||Honda ||2385
 +
|-
 +
!3 ||26 ||0 ||BMW ||3185
 +
|-
 +
!4 ||26 ||1 ||VW ||2294
 +
|-
 +
!5 ||26 ||1 ||Honda ||2314
 +
|-
 +
!6 ||26 ||1 ||BMW ||3294
 +
|-
 +
!7 ||26 ||2 ||VW ||2409
 +
|-
 +
! colspan="5" | ...
 +
|-
 +
!45 ||35 ||4 ||BMW ||5175
 +
|}
 +
 
 +
= See Also =
 +
 
 +
* [[MdTable]]
 +
* [[ConcatRows]]

Revision as of 22:56, 2 February 2007


MdArrayToTable(A,I,L)

Transforms a multi-dimensional array, A, into a two-dimensional array (i.e., a table) indexed by I and L. The result contains one row along I for each element of A. L must contain a list of names of the indexes of A, followed by one final element. All elements of L must be text values. The column corresponding to the final element of L contains the cell value. If L does not contain all the indexes of A, array abstraction will create a set of tables indexed by the dimensions not listed in L.

Transforms a multi-dimensional array, A, into a two-dimensional array (i.e., a table) indexed by I and L. The result contains one row along I for each element of A. L must contain a list of names of the indexes of A, followed by one final element. All elements of L must be text values. The column corresponding to the final element of L contains the cell value. If L does not contain all the indexes of A, array abstraction will create a set of tables indexed by the dimensions not listed in L.

If the number of elements in I is equal to the number of nonzero elements of A, MDArrayToTable() acts like the inverse of MDTable( ) on a table that contains a row for only the nonzero elements of the array.

Library

Array

Example

Rows := sequence(1,size(Cost_in_time))
Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
MDArrayToTable(Cost_in_time,Rows,Cols) →
Rows v, Cols >> Mpg Time Car_type Cost
1 26 0 VW 2185
2 26 0 Honda 2385
3 26 0 BMW 3185
4 26 1 VW 2294
5 26 1 Honda 2314
6 26 1 BMW 3294
7 26 2 VW 2409
...
45 35 4 BMW 5175

See Also

Comments


You are not allowed to post comments.