%% Obtain Dimension with Specified Labels
% Create a formatted dlarray with some repeated dimension labels. Specify the dimension labels as 'TSSU'. The dlarray call reorders the labels, because it enforces the order 'SCBTU'. For more information about dimension labels, see Usage.

dlX = dlarray(randn(5,4,3,2),'TSSU');

% Obtain the dimensions with the label 'T'.

dimU = finddim(dlX,'T')

% Obtain the dimensions with the label 'S'.

dimS = finddim(dlX,'S')

% Obtain the dimensions with the label 'B'.

dimB = finddim(dlX,'B')

% Obtain the size of the dlX dimensions labeled 'S'.

SSize = size(dlX,finddim(dlX,'S'))

% Copyright 2021 The MathWorks, Inc.