%% Size of 4-D Array
% Create a random 4-D array and return its size.

A = rand(2,3,4,5);
sz = size(A)

%
% Query only the length of the second dimension of A.

szdim2 = size(A,2)

%
% Starting in R2019b, you can query multiple dimension lengths at a time by specifying a vector dimension argument. For example, find the lengths of the first and third dimensions of A.

szdim13 = size(A,[1 3])

% Find the lengths of the second through fourth dimensions of A.

szdim23 = size(A,2:4)

% Alternatively, you can list the queried dimensions as separate input arguments.

szdim23 = size(A,2,3,4);

% Copyright 2019 The MathWorks, Inc.