Difference between revisions of "MdArrayToTable"

m (adding doc status category)
Line 33: Line 33:
 
= Example =
 
= Example =
  
 +
Define these global objects (as indexes or variables):
 
  Rows := sequence(1,size(Cost_in_time))
 
  Rows := sequence(1,size(Cost_in_time))
 
  Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
 
  Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
Line 59: Line 60:
 
!45 ||35 ||4 ||BMW ||5175
 
!45 ||35 ||4 ||BMW ||5175
 
|}
 
|}
 +
 +
Note: The expression for doing the same transformation using local indexes looks like
 +
Index Rows := sequence(1,size(Cost_in_time))
 +
Index Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
 +
MDArrayToTable(Cost_in_time,Rows,Cols)
  
 
= See Also =
 
= See Also =

Revision as of 20:26, 27 September 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

Define these global objects (as indexes or variables):

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

Note: The expression for doing the same transformation using local indexes looks like

Index Rows := sequence(1,size(Cost_in_time))
Index Cols := [‘Mpg’,’Time’,’Car_type’,’Cost’]
MDArrayToTable(Cost_in_time,Rows,Cols)

See Also

Comments


You are not allowed to post comments.