Programmer Guide/Command Reference/EVAL/vvcat: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
Create a vector by alternately concatenating the elements of the source vectors. | Create a vector by alternately concatenating the elements of the source vectors. | ||
;Usage: | ;Usage: <code>vvcat(<var>x1</var> {, <var>x2</var> {, ...}})</code> | ||
:;<var>x1</var>, <var>x2</var>, ...: vectors with the same length | :;<var>x1</var>, <var>x2</var>, ...: vectors with the same length | ||
;Result: The result is a vector with <code>''n''*nrow(''x1'')</code> elements, where ''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>. | ;Result: The result is a vector with <code>''n''*nrow(''x1'')</code> elements, where ''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: [[ | ;See also: [[../vv|vv]], [[../vset|vvset]], [[../vvset|vvset]], [[../vmcol|vmcol]], [[../vmrow|vmrow]], [[../vsubn|vsubn]], [[../vsubc|vsubc]] | ||
[[../#Functions|<function list>]] | |||
Example: | Example: | ||
Line 14: | Line 17: | ||
// -> #d = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 } | // -> #d = { 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 } | ||
</pre> | </pre> | ||
Revision as of 12:14, 21 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, where 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 }