Main Content

finddim

Find dimensions with specified label

Description

example

dim = finddim(X,label) returns the dimensions in the dlarray object X that have the specified dimension label.

example

dim = finddim(layout,label) returns the dimensions in the networkDataLayout object layout that have the specified dimension label.

Examples

collapse all

Create a formatted dlarray with format "SSCBT" (spatial, spatial, channel, batch, time).

X = dlarray(randn(6,5,4,3,2),"SSCBT");

View the dimension labels of X.

dims(X)
ans = 
'SSCBT'

Find the dimensions with the label "S".

dim = finddim(X,"S")
dim = 1×2

     1     2

Create a formatted network data layout object representing 2-D image sequences. Specify the format "SSCBT" (spatial, spatial, channel, batch, time).

layout = networkDataLayout([227 227 3 NaN 100],"SSCBT");

Find the dimensions with the label "S".

dim = finddim(layout,"S")
dim = 1×2

     1     2

Input Arguments

collapse all

Input data, specified as a formatted or unformatted dlarray object.

Network data layout, specified as a networkDataLayout object.

Dimension label, specified as one of the following dlarray dimension labels:

  • "S" — Spatial

  • "C" — Channel

  • "B" — Batch

  • "T" — Time

  • "U" — Unspecified

Output Arguments

collapse all

Dimension, returned as a vector of positive integers.

If the input is unformatted or has no dimension labels that match label, then dim is empty.

Extended Capabilities

Version History

Introduced in R2019b