| www.delorie.com/gnu/docs/octave/octave_47.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions allow you to determine the size of a variable or
expression. These functions are defined for all objects. They return
-1 when the operation doesn't make sense. For example, Octave's
data structure type doesn't have rows or columns, so the rows and
columns functions return -1 for structure arguments.
With one input argument and one output argument, the result is returned in a 2 element row vector. If there are two output arguments, the number of rows is assigned to the first, and the number of columns to the second. For example,
size ([1, 2; 3, 4; 5, 6])
=> [ 3, 2 ]
[nr, nc] = size ([1, 2; 3, 4; 5, 6])
=> nr = 3
=> nc = 2
|
If given a second argument of either 1 or 2, size will return
only the row or column dimension. For example
size ([1, 2; 3, 4; 5, 6], 2)
=> 2
|
returns the number of columns in the given matrix.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |