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

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====init=====
Create a vector or a matrix and initialize it with a particular value.
;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''&ge;1 (default='''1''')
:;<var>v</var>: 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: [[../fill|fill]], [[../rand|rand]]


Create a vector or a matrix and initialize it with a particular value. This is a subcommand of the <code>[[Programmer Guide/Command Reference/EVAL/EVAL|EVAL]]</code> command.
[[../#Functions|<function list>]]
 
=====Usage:=====
 
<code>init(<var>rows</var>, <var>cols</var>, <var>value</var>)</code>
 
=====Parameters:=====
 
;<var>rows</var>
 
:The number of rows. There is no default.
 
;<var>cols</var>
 
:The number of columns. The default is <code>1</code>.
 
;<var>value</var>
 
:The value to initialize with. The default is <code>0</code>.
 
=====Return Type:=====
 
vector or matrix

Latest revision as of 19:17, 21 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
fill, rand

<function list>

Navigation menu

Personal tools