NAME
copytable - copy a table associated with a table-handle and optionally
resize it with or without interpolation
SYNOPSIS
table = copytable(table_handle[, newsize[, interp_type]])
Parameters inside the [brackets] are optional.
DESCRIPTION
copytable makes a copy of a table associated with
table_handle. Using the optional newsize argument,
the copied table may be larger or smaller than the original table.
The second optional argument, interp_type determines
if the resized table uses interpolation or simply
truncates the values to determine the values in the new table.
ARGUMENTS
- table_handle
-
The table-handle identifier for the table to be copied and possibly resized
- newsize
-
An optional value setting the size of the copied table. If newsize
is used, then the interp_type should also be specified.
- interp_type
-
If newsize is specified, then the interp_type can
also be set. This is a string, identical to two of the interp
options for
maketable:
- "interp"/"nointerp" -- "interp" enables simple first-order
linear interpolation, i.e. if a requested table value lies between
two elements in the table, setting "interp" will generate an
intermediate value based upon a linear interpolation of nearest
sample values. For example, if the value at table location 314.15
were requested, the value returned would be 0.15 between the
value at location 314 and the value at location 315. "nointerp"
turns off interpolation; the values returned from the table will
be 'rounded-down' (truncated) to the nearest-lowest point in the
table. For example, if the table value at location 149.78 were
requested, the "nointerp" option would return the value stored
at location 149.
The default is interp.
RETURN VALUE
Returns a table-handle for the new, copied and (possibly) resized
table
EXAMPLES
table = maketable("wave", 4000, 1.0, 0.2, 0.1)
newtable = copytable(table, 1000, "interp")
newtable will be associated with a new table that will
contain the same waveform defined in the first maketable,
except that it will only fill 1000 elements instead of 4000.
The new values will be determined by linear interpolation if
they don't align with the values taken from the original 4000-point
table.
SEE ALSO
maketable,
modtable,
makefilter,
makeconverter,
plottable,
dumptable,
tablelen,
mul,
div,
sub,
add