H5Group
provides the Find<T>
method which does just what you are looking for. It iterates over the whole subtree, taking arbitrary predicates into account:
var matches = f.Find<H5Dataset>(
predicate: ds => ds.Attributes.Any(a => a.Name.Contains("att")));
Why not make your function return 'ILCell' instead of a 'List'? This more nicely integrates into the ILNumerics memory management (there will be no storage laying around and waiting for the garbage collector to come by):
using (var f = new H5File("myFile.h5")) {
// create container for the dataset contents
ILCell c = cell(size(1, 1)); // one element init
// retrieve datasets filtered
var matches = f.Find<H5Dataset>(predicate: ds => {
if (ds.Attributes.Any(a => a.Name.Contains("att"))) {
c[end + 1] = ds.Get<double>();
return true;
}
return false;
});
return c;
}
Some links:
http://ilnumerics.net/hdf5-interface.html