%% Create Structure from XML File
% Read an XML file as a structure, create variables from the structure, and query its contents.
% The file music.xml has the following structure.
%
% Read music.xml into MATLAB as a structure S. This structure contains one parent node MusicalEnsemble that has two sibling nodes, Ensemble and Musicians.

S = readstruct("music.xml")

% Create a variable band from the first sibling node. band has three fields, one of which is a structure named Instrumentation.

band = S.Ensemble

% Query Instrumentation in band to view its contents.

band.Instrumentation

% Create a variable musicians from the second sibling node. musicians has one field called Name, which contains five structures.

musicians = S.Musicians

% Copyright 2020 The MathWorks, Inc.