getcol

getcol — Gets a given column from a 2-dimensional array as a vector.

Description

Gets a given column from a 2-dimensional array. The output is an 1-d array with the contents of the requested column

Syntax

i/kout[] getcoli/kin[],i/kcol

Initialization

iout[] -- output array containing the extracted column. It will be created if it does not exist.

iin[] -- input 2-dimensional array.

icol -- column to be extracted.

Performance

kout[] -- output array containing the extracted column. It will be created if it does not exist.

kin[] -- input 2-dimensional array.

kcol -- column to be extracted.

Examples

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

Example 421. Example of the getcol opcode.

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

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
instr 1
 kcnt init 0
 kArr[] init 3,3
 kArr[] fillarray  0,1,2,0,1,2,0,1,2
 while kcnt < 3 do
  kVec[] getcol kArr,kcnt
  printf "column %d: %d %d %d\n",kcnt+1,kcnt,kVec[0],kVec[1],kVec[2] 
  kcnt += 1
 od
endin
</CsInstruments>
<CsScore>
i1 0 0.1
</CsScore>
</CsoundSynthesizer>

See Also

Vectorial opcodes array opcodes

Credits

Author: Victor Lazzarini
NUI Maynooth
2014

New in version 6.04