setcol

setcol — Sets a given column of a 2-dimensional array from a vector.

Description

Sets a given column of a 2-dimensional array. The output is an 2-d array with the contents of the requested column set to values of the input array (1-d; if 2-d the first row of the input array is used).

Syntax

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

Initialization

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

iin[] -- input array.

icol -- column to be extracted.

Performance

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

kin[] -- input array.

kcol -- column to be set.

Examples

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

Example 947. Example of the setcol 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
 kVec[] fillarray  0,1,2
 while kcnt < 3 do
  kArr setcol kVec,kcnt
  printf "column %d: %d %d %d\n",kcnt+1,kcnt,kArr[0][kcnt],kArr[1][kcnt],kArr[2][kcnt] 
  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