MATLAB: How to store results of a Structure

h5hdf5structstructures

Hi,
I am trying to save the output of a structure call.
info_h5 = hdf5info('hdf5_file.h5');
get_FileNames = info_h5.stuff.morestuff.FileNames
info_h5.stuff.morestuff.FilesNames returns 4 string outputs when I run it in command. However, the variable, get_FileNames, only equals the first of the 4 outputs. i.e. get_FileNames = '/file_1'.
How do i store all the outputs of this multilayered structure?
Thanks

Best Answer

Convert to the cell array as
get_FileNames = {info_h5.stuff.morestuff.FileNames}; % enclosed in {} brackets
then access the data as
>> get_FileNames{1} % output 1
>> get_FileNames{2} % output 2
>> get_FileNames{3} % output 3
>> get_FileNames{4} % output 4