- Scilab Online Help
- Scilab
- Scilab keywords
- TMPDIR
- abort
- add_demo
- argn
- banner
- boolean
- break
- clear
- clearfun
- clearglobal
- comp
- continue
- debug
- delbpt
- dispbpt
- edit
- errcatch
- errclear
- error
- error_table
- exists
- exit
- external
- extraction
- format
- funcprot
- funptr
- getdebuginfo
- getmd5
- getmemory
- getmodules
- getos
- getscilabmode
- getshell
- getvariablesonstack
- getversion
- gstacksize
- ieee
- insertion
- intppty
- inv_coeff
- iserror
- isglobal
- lasterror
- macr2lst
- macr2tree
- matrices
- matrix
- mode
- mtlb_mode
- names
- newfun
- null
- pause
- perl
- poly
- predef
- quit
- rational
- readgateway
- resume
- sciargs
- scilab
- setbpt
- stacksize
- startup
- symbols
- testmatrix
- type
- typename
- user
- varn
- ver
- warning
- what
- where
- whereami
- who
- who_user
- whos
- with_atlas
- with_javasci
- with_macros_source
- with_module
- with_pvm
- with_texmacs
- with_tk
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
matrix
reshape a vector or a matrix to a different size matrix
Calling Sequence
y=matrix(v,n,m) y=matrix(v,[sizes])
Arguments
- v
a vector, a matrix or an hypermatrix
- n,m
integers
- sizes
vector of integers
- y
a vector, a matrix or hypermatrix
Description
For a vector or a matrix with n
x m
entries, the command
y=matrix(v,n,m)
or similarily y=matrix(v,[n,m])
transforms the v
vector (or matrix) into an nxm
matrix by
stacking columnwise the entries of v
.
if one of the dimension m or n is equal to -1 it is automatically assigned to the quotient of size(v,'*') by the other dimension,
For an hypermatrix such as
prod(size(v))==prod(sizes)
, the command y=matrix(v,sizes)
(or
equivalently y=matrix(v,n1,n2,...nm)
) transforms
v
into an matrix or hypermatrix by
stacking "columnwise" (first dimension is varying first) the entries of v
. y=matrix(v,sizes)
results in a regular matrix if sizes is a scalar or a 2-vector.
Examples
a=[1 2 3;4 5 6] matrix(a,1,6) matrix(a,1,-1) matrix(a,3,2)
<< matrices | Scilab | mode >> |