WLJS LogoWLJS Notebook

ArrayDepth

ArrayDepth[expr] gives the depth to which expr is a full (rectangular) array, with all parts at each level having the same length.

Examples

Depth of a matrix:

ArrayDepth[{{1, 2, 3}, {4, 5, 6}}]
(* 2 *)

Depth of a 3D array:

ArrayDepth[{{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}]
(* 3 *)

Non-rectangular arrays:

ArrayDepth[{{1, 2}, {3}}]
(* 1 - not rectangular at depth 2 *)

Please visit the official Wolfram Language Reference for more details.

On this page