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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Extract elements from a vector.
Extract elements from a vector.
 
;Usage: <code><var>vvget(x</var> {, <var>o</var> {, <var>d</var> {,<var>n</var> }}})</code>
;Usage: '''<code><var>vvget(x</var> {, <var>o</var> {, <var>d</var> {,<var>n</var> }}})</code>'''
:;<var>x</var>: the source vector, l<sub>x</sub>=nrow(''x'') must be greater/equal 1
:;<var>x</var>: the source vector, l<sub>x</sub>=nrow(''x'') must be greater/equal 1
:;<var>o</var>: the first element to be extracted, 0 <= ''o'' < l<sub>x</sub> (default='''0''')
:;<var>o</var>: the first element to be extracted, 0 &le; ''o'' < l<sub>x</sub> (default='''0''')
:;<var>d</var>: the index increment (default='''1''')
:;<var>d</var>: the index increment (default='''1''')
:;<var>n</var>: the number of elements to extract, ''n''>0 (default='''l<sub>x</sub>''')
:;<var>n</var>: the number of elements to extract, ''n''>0 (default='''l<sub>x</sub>''')
;Result: A numerical object ''r'' (scalar or vector) with ''n'' elements.
;Result: A numerical object ''r'' (scalar or vector) with ''n'' elements  
::<code>''r''<sub>i</sub> = x<sub>''o''+i*''d''</sub>; with i=0..''n''-1
::<code>''r''<sub>i</sub> = x<sub>''o''+i*''d''</sub></code>; with i=0..''n''-1
::Note: For all i, the source index ''o''+i*''d'' must be in the range 0 to l<sub>x</sub>-1, otherwise the function failes.
:Note: For all i, the source index ''o''+i*''d'' must be in the range 0 to l<sub>x</sub>-1, otherwise the function fails.
;See also: [[Programmer_Guide/Command_Reference/EVAL/vv|vv]], [[Programmer_Guide/Command_Reference/EVAL/vvset|vvset]], [[Programmer_Guide/Command_Reference/EVAL/vvcat|vvcat]], [[Programmer_Guide/Command_Reference/EVAL/vmcol|vmcol]], [[Programmer_Guide/Command_Reference/EVAL/vmrow|vmrow]], [[Programmer_Guide/Command_Reference/EVAL/vsubn|vsubn]], [[Programmer_Guide/Command_Reference/EVAL/vsubc|vsubc]]
;See also: [[../vv|vv]], [[../vvset|vvset]], [[../vvcat|vvcat]], [[../vmcol|vmcol]], [[../vmrow|vmrow]], [[../vsubn|vsubn]], [[../vsubc|vsubc]]


Example:
[[../#Functions|<function list>]]
<pre>
#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 }
</pre>


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]


 
Example:
 
#a := eval vv(1,2,4,8,16,32)
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
#b := eval vvget($#a, 0, 2, 3)
=====vvget=====
// &rarr; #b = { 1 , 4 , 16 }
 
#c := eval vvget($#a, 5, -1, 4)
{|
// &rarr; #c = { 32, 16, 8, 4 }
|-
|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>]
|}

Latest revision as of 19:04, 21 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 fails.
See also
vv, vvset, vvcat, vmcol, vmrow, vsubn, vsubc

<function list>


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 }

Navigation menu

Personal tools