Main Content

dims

Data format of dlarray object

Description

The dims function returns the data format of the input.

A data format is a string of characters, where each character describes the type of the corresponding data dimension.

The characters are:

  • "S" — Spatial

  • "C" — Channel

  • "B" — Batch

  • "T" — Time

  • "U" — Unspecified

For example, consider an array containing a batch of sequences where the first, second, and third dimensions correspond to channels, observations, and time steps, respectively. You can specify that this array has the format "CBT" (channel, batch, time).

d = dims(X) returns the data format of X as a character array. The data format provides the dimension labels for each dimension in X.

example

Examples

collapse all

Obtain the dimension labels of a formatted dlarray.

dlX = dlarray(randn(3,4),'TS');
d = dims(dlX)
d = 
'ST'

Obtain the labels of an unformatted dlarray.

y = stripdims(dlX);
d = dims(y)
d =

  0x0 empty char array

Input Arguments

collapse all

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

Output Arguments

collapse all

Dimension labels, returned as a character vector. If the input X is unformatted, d is empty.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2019b