anydata.h5 file

Hi AnyBody community!

I would like to have some details about saving/reading anydata.h5 files.

First, does the deep structure save everything from the study?

The flat structure only returns the tree structure right?

Second, if I want to read the h5 file, is using hdf5read in MatLab the best option? Say I want to have access to the Gastrocnemius force and plot it?
Is the following the best thing to do?

Fm_gastro=hdf5read(‘filename.anydata.h5’,’/Output/Model/HumanModel/Left/Leg/Mus/Gastrocnemius/Fm’)

Thank you very much!

Stephanie

The deep structure h5 file saves everything from the study. I don’t know what the flat structure does.

I think matlab is the best option for processing the data, but if you just want to have a quick look at the files I can recommend hdfview.

I believe h5read is the function to use because hdf5read will be removed in a future version of matlab.

Hi Stephanie,

We do not use Matlab and I cannot try this exact syntax, but i expect something like the following to do the job (possibly not the most efficient way):
Fm_gastro = hdf5read(‘filename.anydata.h5’).Output.Model.HumanModel.Left.Leg.Mus.Gastrocnemius.Fm;

I tried the following in Octave and it worked for me - I expect it to work similarly in Matlab:
Fm_gastro = load(‘filename.anydata.h5’).Output.Model.HumanModel.Left.Leg.Mus.Gastrocnemius.Fm;

Otherwise you could just try the attribute filter (try with dots) as you described and see whether this works or not.

Alternatively you may just use AnyOutputFile class to get the values that you need rather than outputting everything.

Regards,
Pavel

Hi Stephanie,
Here is the right way to write a command in matlab (R2012b) :

SS = h5read('Results - SS.anydata.h5', '/Output/Model/SSMuscle/Fm');

In fact you just have to call it in the same way it is written in you Anybody tree.

Hope it will help you !
Lauranne

Thanks all for your prompt replies!

I was wondering if I send the h5 file to someone who doesn’t know the structure of the AnyBody tree, would it be possible to actually display the contents of the h5 file within MatLab in a quick way?

Hi Stephanie
In fact, yes, you can, but it’s pretty long :wink: Here is the way :

Info= h5info('SS.anydata.h5');

This will create a structure variable containing the whole model. To find your variable of interest, you’ll have to look into the “group” substructure.

Another way is to display the informations :

h5disp('SS.anydata.h5');

This will write all your content in the Matlab command window. It can be pretty convinient if your model is small but become tough if you have a lot of variable your anybody model.

Hope it’s clear !
Lauranne

Thanks Lauranne! I’ll try that!