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

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:ncol (alias: cols)}}
=====ncol=====
Returns the number of columns of the argument <var>x</var>.
;Usage: <code>ncol(<var>x</var>)</code>
;Result: The result of this function is the number of columns of <var>x</var>. If <var>x</var> is a scalar or a vector, the result is '''1'''.
;See also: [[../nrow|nrow]]


The number of columns in <var>x</var>.
[[../#Functions|<function list>]]


{|
 
|-
Example:
|Usage:
<pre>
|ncols(x)
#matrix := eval init(100,10,0)
|-
conlog 'number of columns of $#matrix: $(eval ncol($#matrix))'
|
// the attribute !ncol returns the same value:
|cols(x)
conlog 'number of columns of $#matrix: $#matrix[!ncol]'
|-
</pre>
|Result:
|The number of columns in x (1 for scalars and vectors).
|-
|Return Type:
|scalar
|}

Latest revision as of 11:25, 21 April 2011

Returns the number of columns of the argument x.

Usage
ncol(x)
Result
The result of this function is the number of columns of x. If x is a scalar or a vector, the result is 1.
See also
nrow

<function list>


Example:

#matrix := eval init(100,10,0)
conlog 'number of columns of $#matrix: $(eval ncol($#matrix))'
// the attribute !ncol returns the same value:
conlog 'number of columns of $#matrix: $#matrix[!ncol]'

Navigation menu

Personal tools