- Scilab Help
- Elementary Functions
- Bitwise operations
- Complex
- Discrete mathematics
- Elementary matrices
- Log - exp - power
- Floating point
- Radix conversions
- Matrix manipulation
- Matrix operations
- Search and sort
- Set operations
- Signal processing
- Symbolic
- Trigonometry
- and
- &
- cat
- cell2mat
- cellstr
- iscolumn
- isempty
- isequal
- ismatrix
- isrow
- isscalar
- issquare
- isvector
- lstsize
- modulo
- ndims
- nthroot
- num2cell
- or
- |
- sign
- size
- unwrap
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
size
size of objects
Calling Sequence
sz = size(x) [n1, n2] = size(x) [n1, n2, n3, ...] = size(x) n = size(x, sel)
Arguments
- x
a 2-D or n-D array of any type or a list
- sz
1
by ndims(x) integer vector.- sel
a positive scalar with integer value or one of the character strings 'r', 'c' or '*'
- n1, n2, ...
numbers with integer values
- n
a number with integer value
Description
- Applied to :
an array or n-D array (constant, polynomial, string, boolean, rational)
sz = size(x)
returns a1
-by-ndims(x)
vector. Each entry gives the corresponding dimension value.[n1, n2, ...] = size(x)
, the function returns in each argument the corresponding dimension value.- The syntax
n = size(x, sel)
may be used to specify what dimension to get:- Set
sel
to 1 or'r'
to get the number of rows. - Set
sel
to 2 or'c'
to get the number of columns. - Set
sel
tom
, wherem
is a positive integer to get them
th dimension. Ifm
is greater thanndims(x)
, thensize(x,m)
returns 1. - Set
sel
to'*'
to get the product of the dimensions.
- Set
- Applied to:
a list; it returns the number of elements. In this case only
y = size(x)
syntax can be used.- Applied to:
a linear system;
y= size(x)
returns iny
the (row) vector [number of outputs, number of inputs] i.e. the dimension of the corresponding transfer matrix. The syntax[nr, nc] = size(x)
is also valid (with(nr, nc) = (y(1), y(2))
). Ifx
is a linear system in state-space form, then[nr, nc, nx] = size(x)
returns in addition the dimensionnx
of matrixx
.
Examples
[n, m] = size(rand(3, 2)) [n, m] = size(['a', 'b'; 'c', 'd']) x = ssrand(3, 2, 4); [ny, nu] = size(x) [ny, nu] = size(ss2tf(x)) [ny, nu, nx] = size(x) // Returns the number of rows n = size(rand(3, 2), "r") // Returns the number of columns m = size(rand(3, 2), "c") // Returns the product of the dimensions nm = size(rand(3, 2), "*")
See Also
Report an issue | ||
<< sign | Elementary Functions | unwrap >> |