finddim - Find dimensions with specified label - MATLAB (original) (raw)
Find dimensions with specified label
Syntax
Description
The finddim
function finds the dimension index of a formatted dlarray
object for a specified label.
[dim](#mw%5F00d27330-1a43-4dd3-b530-770468972acd) = finddim([X](#mw%5F97291a49-61e6-4bfd-b983-9b08ae8e7a76%5Fsep%5Fmw%5F6f734774-5538-44ff-ad05-7e744f97893a),[label](#mw%5F7e0c7d6a-8ec0-457b-b5fd-d440a9a4196d))
returns the dimensions in the dlarray
object X
that have the specified dimension label.
[dim](#mw%5F00d27330-1a43-4dd3-b530-770468972acd) = finddim([layout](#mw%5F26c02e35-a38d-4c01-87ff-cd7ffea36df4),[label](#mw%5F7e0c7d6a-8ec0-457b-b5fd-d440a9a4196d))
returns the dimensions in the networkDataLayout
objectlayout
that have the specified dimension label.
Examples
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
.
Find the dimensions with the label "S"
.
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")
Input Arguments
Input data, specified as a formatted or unformatted dlarray object.
Dimension label, specified as one of the followingdlarray
dimension labels:
"S"
— Spatial"C"
— Channel"B"
— Batch"T"
— Time"U"
— Unspecified
Output Arguments
Dimension, returned as a vector of positive integers.
If the input is unformatted or has no dimension labels that matchlabel, then dim
is empty.
Extended Capabilities
Usage notes and limitations:
- The input data must be a
dlarray
object. - The label argument must be a compile-time constant.
Usage notes and limitations:
- The input data must be a
dlarray
object. - The label argument must be a compile-time constant.
Version History
Introduced in R2019b