HDF5 - reading part of dataset

45 ビュー (過去 30 日間)
Pavel Inchin
Pavel Inchin 2019 年 1 月 28 日
編集済み: Sunson29 2019 年 4 月 15 日
I'd like to read only part of the dataset of HDF5 file using h5read function in Matlab . Particularly in 1 of the dimensions I want to read only every 4th value.
I can read the whole dataset as:
tempp = hdf5read(nameCur,namedataset);
its size: 160x100x200x10.
Next, when I want to read the whole dataset using "start" and "count" attributes, it works fine:
tempp = h5read(nameCur,namedataset,[1 1 1 1],[160 100 200 10]);
Then I want to read all dataset using "stride" attribute too:
tempp = h5read(nameCur,namedataset,[1 1 1 1],[160 100 200 10],[1 1 1 1]);
works nice!
But when I want finally to read every 4th value from second dimension
tempp = h5read(nameCur,namedataset,[1 1 1 1],[160 100 200 10],[1 4 1 1]);
it gives me error:
Error using h5readc
The index arguments exceed the size of the dataset.
I don't understand what is the reason for that. Thanks
  1 件のコメント
Pavel Inchin
Pavel Inchin 2019 年 4 月 15 日
Just in case someone stucked with this, the solution is simply:
tempp = h5read(nameCur,namedataset,[1 1 1 1],[160 25 200 10],[1 4 1 1]);

サインインしてコメントする。

回答 (2 件)

Sunson29
Sunson29 2019 年 4 月 15 日
編集済み: Sunson29 2019 年 4 月 15 日
Dear friend, I hope I could answer your question. But I guess I am more "beginer " than you.
May I ask a very quick question ?
I am trying to open just one portion of HDF5 file, because it's way too big (20G). In that files, there are 3 dataset, X,Y,Z, X is the 20G, others are small, can be open directly.
I can run the code "dset = hdf5read('GOLD_XYZ_OSC.0001_1024.hdf5','/Z');";
but why I cannot run the code like you do dset = hdf5read('GOLD_XYZ_OSC.0001_1024.hdf5','/Z', [1 1], [1 3]);
Error: Expected a string scalar or character vector for the parameter name.
Z is a big row, one row, many column. I tried to put just few elements (i=1:3) in dset. Thank you!!!!
  1 件のコメント
Pavel Inchin
Pavel Inchin 2019 年 4 月 15 日
編集済み: Pavel Inchin 2019 年 4 月 15 日
what is a size of "Z" you'd like to read?

サインインしてコメントする。


Sunson29
Sunson29 2019 年 4 月 15 日
編集済み: Sunson29 2019 年 4 月 15 日
my friend, you reply so fast!
Could you go to this link plz? It's easier to see.
I got very very similiar index issue, like you had before. Thank you!!!!

カテゴリ

Help Center および File ExchangeHDF5 についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by