vvset
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
vvset
vvset(x, yS, o, d, n) | Create a copy of the vector x and replace the elements o+i*d (i = 0..n-1) with the value ys. |
vvset(x, y, o, d) | Create a copy of the vector x and replace the elements o+i*d (i = 0..nrow(y)-1) with the values y[i] |
Create a copy of the vector x and replace elements.
- Usage 1
vvset(x , y {, o {, d, n}}})
- x
- source vector
- y
- replace value
- o
- starting index, 0 <= o <
nrow(x)
(default=0) - d
- index increment (default=1)
- n
- number of values to replace (default=
nrow(x)
)
- Result 1
- The result r is copy of the vector x. All elements r[o+i*d] (i = 0..n-1) are replaced by the value y.
- Usage 2
vvset(x , y {, o {, d}})
- x
- source vector
- y
- replace vector
- o
- starting index, 0 <= o <
nrow(x)
(default=0) - d
- index increment (default=1)
- Result 1
- The result r is copy of the vector x. All elements r[o+i*d] (i = 0..nrow(y)-1) are replaced by the value y[i].
The function failes if an index value is out of bounds.
Example:
#a := eval vv(1,2,4,8,16,32) #b := eval vvget($#a, 0, 2, 3) // -> #b = { 1 , 4 , 16 } #c := eval vvget($#a, 5, -1, 4) // -> #c = { 32, 16, 8, 4 }