sortd

sortd — Sorts an array in descending order.

Description

Takes a numeric array (k or i-rate) and returns it sorted in descending order.

Syntax

k/i[]sortd k/i[]  (k- or i-arrays )

Examples

Here is an example of the sortd opcode. It uses the file sortd.csd.

Example 923. Example of the sortd opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>

instr 1
 kArr[] fillarray 1,3,2,7,4
 kSorted[] sortd kArr
 kn = 0
 while kn < lenarray(kSorted) do
  printk2 kSorted[kn]
  kn += 1
 od
 turnoff
endin


</CsInstruments>
<CsScore>
i1 0 1
</CsScore>
</CsoundSynthesizer>


See Also

sorta

Credits

Author: Victor Lazzarini

New in version 6.09