size
Returns the size of a matrix or a pixmap.
Syntax
-
size(X)-
Xis any object
-
Description
For a two-dimensional container, such as a matrix or a pixmap, size(X) returns the size of X as a structure with members rows and cols.
A vector is treated like a two-dimensional container in the form of a column matrix.
For all other objects, size(X) returns the structure struct("rows": 1, "cols": 1).
Examples
A ≔ ❨❨6, 3, 2, 0, 4, 5❩, ❨7, 0, 2, 1, 4, 2❩, ❨6, 2, 3, 1, 4, 2❩, ❨8, 0, 2, 3, 3, 5❩, ❨4, 2, 6, 3, 2, 0❩❩
⎛6 3 2 0 4 5⎞ ⎜7 0 2 1 4 2⎟ ⎜6 2 3 1 4 2⎟ ⎜8 0 2 3 3 5⎟ ⎝4 2 6 3 2 0⎠
size(A)
rows: 5 cols: 6
bm ≔ ComputePixmap(200, 200, x, y, rgb(x/199, y/199, 0.5))
A pixmap of size 200×200.
size(bm)
rows: 200 cols: 200
size(π)
rows: 1 cols: 1