size

size(x)

Try it yourself:


size(): Inspecting Array Dimensions

size() returns the dimensions of an array or matrix. It is essential for validating data before matrix operations, slicing, or reshaping.

Prevent shape errors

Check size before multiply(), reshape(), or concat(). Matching total counts is not always enough: matrix multiplication requires compatible inner dimensions.

Use row() and column() after confirming an index is present. For an empty collection, dimensions can still be meaningful, so handle zero-length axes explicitly.

Try Size in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions