%% Get Information on Elements in Non-Uniform Structure
% Create a structure from an XML file that does not contain uniformly-structured data, then show its contents.
% If a sibling node contains fields that other sibling nodes do not have, readstruct returns missing for the fields that are not found in other nodes. For example, in the file music.xml, the second Instrument node contains a non-empty field pianotype. Since the other Instrument nodes do not have a value specified for pianotype, readstruct returns missing for pianotype under those Instrument nodes.
%
% Read the XML file music.xml to a structure S.

S = readstruct("music.xml")

% Query the Instrument structure in S to view its contents.

S.Ensemble.Instrumentation.Instrument

% Copyright 2020 The MathWorks, Inc.