How to store results of a Structure

1 vue (au cours des 30 derniers jours)
Patrick Campbell
Patrick Campbell le 21 Nov 2019
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

Réponse acceptée

Bhaskar R
Bhaskar R le 21 Nov 2019
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
  2 commentaires
Patrick Campbell
Patrick Campbell le 23 Nov 2019
Thanks you two! Helped a lot. I also wasn't even sure how to look this question up, so the exra information helps a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by