Objects Mixture <Prev Next>


Table objects can be used in expressions to specify a table of function values, rather than using a formula. They can be placed at the top level in the hierarchy, in which case they are global and available in any expression, or placed under an object which uses expressions, such as  Custom Population Functions or Custom Transition Functions, in which case they are local to the object.

To set up the table, create it (right click the object under which it is to be placed and select "Add New, Table". The table values can then be imported from a text or csv file by right clicking on the object and selecting Load... or Paste. The expected format is a file with n numbers on each line. The first n-1 numbers are the keys used to lookup in the table, and the last number is the value to return. (n should be the same on each line.) Optionally the first line can contain column names as text. Some limited editing is possible in the constants window; for more flexible editing copy and paste ito a spreadsheet or text editor.

In expressions, the table behaves as a function with the same name as the table object, and n-1 arguments. The default name is simply Table, so a call might look like:

and a matching data file might look like:
J'	J"	Value
0 1 0.5
1 2 1.5

In evaluating the function a simple scan of the table is done, looking for an exact match of all n-1 arguments. If no match is found, the function returns 0. For a more complicated example see CH3simplevibBX.pgo described in The B-X Transition in CH3.


Debug Write the values of the input variables and the value returned on each look up in the table to the log window. Note that this can produce a lot of output.