Reading multiple datasets in hdf5
22 ビュー (過去 30 日間)
古いコメントを表示
I have an HDF5 file format where the datasets are in a group like /abc/xyz1 to /abc/xyznnn
All these have similar datasets: name, age, loc
How do I loop through these n subgroups to read all the data from the hdf5 file?
0 件のコメント
回答 (1 件)
Animesh
2023 年 5 月 30 日
Hello!
You can use MATLAB's h5info function to get information about the contents of the HDF5 file(including the names of the datasets and groups) and h5read to read the data from the dataset.
You can do something like this to read all the data from all subgroups of "/abc":
filename = 'yourfile.h5';
info = h5info(filename, '/abc');
subgroup_names = {info.Groups.Name};
for i = 1:length(subgroup_names)
groupname = subgroup_names{i};
name = h5read(filename, strcat(groupname, '/name'));
age = h5read(filename, strcat(groupname, '/age'));
loc = h5read(filename, strcat(groupname, '/loc'));
% Do something with the data
end
You may refer to the following documentation for more information:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で HDF5 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!