maxarray
Returns the maximum value in a numeric array and optionally its index.
Syntax
Performance
kmax -- variable for result.
kindx -- position (index) of result in array.
karray -- array for reading.
The array must be initialized and nonempty. The i-rate form runs once at initialization. The k-rate form reads the array on each control cycle.
The optional index is zero-based and selects the first occurrence when values tie. For a multidimensional array, it counts through all elements in storage order, with the last dimension changing fastest.
Replacing maxtab
maxtab is the deprecated k-rate name. Replace kValue, kIndex = maxtab(kArray) with kValue, kIndex = maxarray(kArray). Keep the same array and outputs. Both names use the same k-rate implementation. Only maxarray offers the i-rate form.
Examples
Here is an example of the maxarray opcode. It uses the file maxarray.csd.
See also
Credits
Author: John ffitch
October 2011
New in Csound version 5.14
Revised in Csound version 6.00 to work on multidimensional arrays