Skip to contents

This function returns the dimension of the specified axis for a given object, such as a matrix or an array.

Usage

which_dim(x, axis)

# S4 method for NeuroSpace,NamedAxis
which_dim(x, axis)

Arguments

x

An object representing the input data, such as a matrix or an array.

axis

An integer representing the axis for which the dimension is requested. For example, 1 for rows, 2 for columns, or 3 for the depth in a 3D array.

Value

An integer representing the dimension of the specified axis for the given object.

Examples


x <- NeuroSpace(c(10,10,10), spacing=c(1,1,1))
which_dim(x, x@axes@j) == 2
#> [1] TRUE