Programmer Guide/Command Reference/EVAL/init: 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 or a matrix and initialize it with a particular value. | Create a vector or a matrix and initialize it with a particular value. | ||
;Usage: <code>init(<var> | ;Usage: <code>init(<var>n</var> {, <var>m</var> {, <var>v</var>}})</code> | ||
:;<var>n</var>: number of rows, ''n''>1 | |||
:: | :;<var>m</var>: number of columns, ''m''>=1 (default='''1''') | ||
:;<var> | :;<var>v</var>: initialization value (default='''0''') | ||
:;<var> | ::All arguments are scalars! | ||
;Result: The result is a | ;Result: The result is a numerical object with ''n'' rows and ''m'' columns. All elements are set to ''v''. | ||
;See also: [[Programmer_Guide/Command_Reference/EVAL/init|init]], [[Programmer_Guide/Command_Reference/EVAL/rand|rand]] | ;See also: [[Programmer_Guide/Command_Reference/EVAL/init|init]], [[Programmer_Guide/Command_Reference/EVAL/rand|rand]] | ||
Revision as of 13:14, 4 April 2011
Create a vector or a matrix and initialize it with a particular value.
- Usage
init(n {, m {, v}})
- n
- number of rows, n>1
- m
- number of columns, m>=1 (default=1)
- v
- initialization value (default=0)
- All arguments are scalars!
- Result
- The result is a numerical object with n rows and m columns. All elements are set to v.
- See also
- init, rand
Parameters:
- rows
- The number of rows. There is no default.
- cols
- The number of columns. The default is
1
.
- value
- The value to initialize with. The default is
0
.
Return Type:
vector or matrix