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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 10: Line 10:
<pre>
<pre>
#matrix := eval init(100,10,0)
#matrix := eval init(100,10,0)
conlog 'number of columns of $#matrix: $(eval ncol($#matrix)'
conlog 'number of columns of $#matrix: $(eval ncol($#matrix))'
// the attribute !ncol returns the same value:
// the attribute !ncol returns the same value:
conlog 'number of columns of $#matrix: $#matrix[!ncol]'
conlog 'number of columns of $#matrix: $#matrix[!ncol]'

Revision as of 10:11, 4 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. The function cols(x) can be used as alias for ncol.
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]'
See also
nrow

<function list>

Navigation menu

Personal tools