Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: Français - Português - 日本語 - Русский

See the recommended documentation of this function

Scilab Help >> Data Structures > hypermatrices

# hypermatrices

a Scilab object, N dimensional matrix in Scilab

### Description

Hypermatrix type allows to manipulate multidimensional arrays.

They can be defined by extension of 2D matrices as follows `a=[1 2;3 4];a(:,:,2)=rand(2,2)` or directly using `hypermat` function.

Entries can be real or complex numbers, polynomials, rationals, strings, booleans.

Hypermatrices are `mlists`: `mlist(['hm','dims','entries'],sz,v)` where `sz` is the row vector of dimensions and `v` the column vector of entries (first dimension are stored first). The number of dimension of hypermatrices with right-most sizes equal to 1 are automatically reduced. An hypermatrix with only two dimensions is automatically changed to a regular matrix (type 1).

### Examples

```a(1,1,1,1:2)=[1 2]
a=[1 2;3 4];a(:,:,2)=rand(2,2)
a(1,1,:)

size(a)

a(:,:,1) //dimensionality reduction
type(a(:,:,1))

[a a]```

• hypermat — initializes an N dimensional matrix
• zeros — matrix made of zeros
• ones — matrix made of ones
• grand — Random numbers
• matrix — reshape a vector or a matrix to a different size matrix