Programmer Guide/Command Reference/EVAL/vvget: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 22: Line 22:


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====vvget=====
{|
|-
|vvget(x, <var>o</var>, <var>d</var>, <var>n</var>)
|Result: res[i = 0..n-1] = <var>x</var>[<var>o</var> + i*<var>d</var>]
|}

Revision as of 14:44, 4 April 2011

Extract elements from a vector.

Usage
vvget(x {, o {, d {,n }}})
x
the source vector, lx=nrow(x) must be greater/equal 1
o
the first element to be extracted, 0 <= o < lx (default=0)
d
the index increment (default=1)
n
the number of elements to extract, n>0 (default=lx)
Result
A numerical object r (scalar or vector) with n elements
ri = xo+i*d; with i=0..n-1
Note: For all i, the source index o+i*d must be in the range 0 to lx-1, otherwise the function failes.
See also
vv, vvset, vvcat, vmcol, vmrow, vsubn, vsubc

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 }

<function list>

Navigation menu

Personal tools