%% Elements of Field
% Create a structure with a field whose value is an array.

S.a = [5 10 15 20 25]

%
% Return elements of the array using the getfield function. To return a subarray, specify indices after the name of the field. You must specify the indices within a cell array.

value = getfield(S,'a',{[2:4]})

%
% You also can use dot notation and array indexing to access the same elements.

value = S.a(2:4)

% Copyright 2018 The MathWorks, Inc.