table
Syntax
- fy = table(t,fx)
- table(t,fx) = fy
Get/set a table entry.
When getting a table entry, the table t is consulted, and a \(y\)-value corresponding to the given value of \(x\) is found by interpolation. If \(x\) is less than or greater than any \(x\)-value in the table, then the \(y\)-value associated with the least or greatest \(x\)-value is returned. The result of this function is not defined if the table is not sorted by increasing \(x\)-value.
When setting a table entry, an (x,y) pair is inserted into the first appropriate place in the table t (i.e., the new item is inserted between two existing items with \(x\)-values that bracket the given value of \(x\)). The new item is placed at the beginning of the table or appended to the end if the given \(x\) is less than the lowest \(x\) or greater than the greatest \(x\), respectively. The number of items in the table is increased by one following execution of this statement. If table t does not exist, it is created, and the given item is taken as the first entry. If the given \(x\) is identical to the stored \(x\) of an (x,y) pair, then the \(y\)-value is updated instead of a new pair inserted.
Note
A new table is created if a unique integer or string name is given as the first argument.
Returns: fy - \(y\)-value
Accepts: fy - \(y\)-value
Arguments: t - integer name, string name or table pointer
fx - \(x\)-value
Index Access
Was this helpful? ... | PFC © 2021, Itasca | Updated: Feb 25, 2024 |