Scilab Function

matrix - reshape a vector or a matrix to a different size matrix

Calling Sequence

y=matrix(v,n,m)
y=matrix(v,[sizes])

Parameters

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

See Also