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

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====vvcat=====
Create a vector by alternately concatenating the elements of the source vectors.
;Usage: '''<code>vvcat(<var>x1</var> {, <var>x2</var> {, ...}})</code>'''
:;<var>x1</var>, <var>x2</var>, ...: vectors with the same length
;Result: The result is a vector with <code>n*nrow(''x1'')</code> elements, with ''n'' is the number of arguments. The elements of the source vectors are alternatly assigned to the result: <code>r = { x1[0], x2[0], .., x''n''[0], x1[1], x2[1], .., x''n''[1], .. }</code>.
;See also: [[Programmer_Guide/Command_Reference/EVAL/vv|vv]], [[Programmer_Guide/Command_Reference/EVAL/vvset|vvset]], [[Programmer_Guide/Command_Reference/EVAL/vvset|vvset]], [[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]]


{|
Example:
|-
<pre>
|vvcat(x1V, <var>x2</var>V,...)
#a := eval vv(1,1,1,1}
|Create a vector by alternately concaternating the elements of the arguments (vectors with the same length).The result is: { x1V[0], <var>x2</var>V[0], .., <var>x1</var>V[1], <var>x2</var>V[1], ..}
#b := eval vv(2,2,2,2}
|}
#c := eval vv(3,3,3,3}
#d := eval vvcat($#a,$#b,$#c)
// -> #d = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 }
</pre>
 
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Revision as of 08:08, 6 April 2011

Create a vector by alternately concatenating the elements of the source vectors.

Usage
vvcat(x1 {, x2 {, ...}})
x1, x2, ...
vectors with the same length
Result
The result is a vector with n*nrow(x1) elements, with n is the number of arguments. The elements of the source vectors are alternatly assigned to the result: r = { x1[0], x2[0], .., xn[0], x1[1], x2[1], .., xn[1], .. }.
See also
vv, vvset, vvset, vmcol, vmrow, vsubn, vsubc

Example:

#a := eval vv(1,1,1,1}
#b := eval vv(2,2,2,2}
#c := eval vv(3,3,3,3}
#d := eval vvcat($#a,$#b,$#c) 
// -> #d = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 }

<function list>

Navigation menu

Personal tools