Programmer Guide/Command Reference/EVAL/vmcol: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
Create a matrix by merging columns of source vectors and/or matrices. | Create a matrix by merging columns of source vectors and/or matrices. | ||
;Usage: | ;Usage: <code><var>vmcol(x1</var> {, <var>x2</var> {, .. }})</code> | ||
:;<var>x1</var>, <var>x2</var>, ..: source vectors and/or matrices with the same number of rows | :;<var>x1</var>, <var>x2</var>, ..: source vectors and/or matrices with the same number of rows | ||
;Result: A matrix with <code>nrow(''x1'')</code> rows. The columns of arguments are merged from left to right. | ;Result: A matrix with <code>nrow(''x1'')</code> rows. The columns of the arguments are merged from left to right. | ||
;See also: [[ | ;See also: [[../vv|vv]], [[../vvset|vvget]], [[../vvset|vvset]], [[../vvcat|vvcat]], [[../vmrow|vmrow]], [[../vsubn|vsubn]], [[../vsubc|vsubc]] | ||
[[../#Functions|<function list>]] | |||
Example: | Example: | ||
Line 11: | Line 14: | ||
#b := eval init(5,2,0) | #b := eval init(5,2,0) | ||
#c := eval vmcol($#a, $#b, $#a) | #c := eval vmcol($#a, $#b, $#a) | ||
// -> #c[*,0] = $#a, | // -> $#c is a matrix with 5 rows and 4 columns: | ||
// $#c[*,0] = $#a, #c[*,1] = $#b[*,0], $#c[*,2] = $#b[*,1], $#c[*,3] = $#a | |||
</pre> | </pre> | ||
Latest revision as of 12:03, 21 April 2011
Create a matrix by merging columns of source vectors and/or matrices.
- Usage
vmcol(x1 {, x2 {, .. }})
- x1, x2, ..
- source vectors and/or matrices with the same number of rows
- Result
- A matrix with
nrow(x1)
rows. The columns of the arguments are merged from left to right. - See also
- vv, vvget, vvset, vvcat, vmrow, vsubn, vsubc
Example:
#a := eval vv(1,2,3,4,5) #b := eval init(5,2,0) #c := eval vmcol($#a, $#b, $#a) // -> $#c is a matrix with 5 rows and 4 columns: // $#c[*,0] = $#a, #c[*,1] = $#b[*,0], $#c[*,2] = $#b[*,1], $#c[*,3] = $#a