<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785</link>
    <title>MATLAB Central Newsreader - reading HDF5 dataset subset</title>
    <description>Feed for thread: reading HDF5 dataset subset</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 02 Nov 2009 22:15:21 -0500</pubDate>
      <title>reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691592</link>
      <author>Tess </author>
      <description>Using the low-level HDF5 functions in Matlab, I have generated some HDF5 files with several datasets that are each 512x512x1410.  I need to be able to read subsets of these different layers.  Looks like hdf5read does not have subsetting capabilities like hdfread, so I am guessing I need to use low-level functions such as H5D.read.  How do I translate something like the following high level hdfread call into those HDF5 low-level functions?:&lt;br&gt;
&lt;br&gt;
data=hdfread('filename','/dataset_name','Index',{[start],[stride],[size]});&lt;br&gt;
e.g.&lt;br&gt;
sst=hdfread(file,'/WeeklySST','Index',{[1 1 999],[1 1 1],[512 512 1]});&lt;br&gt;
&lt;br&gt;
(Chunk size is set to 512x512x1, but I need to read across those boundaries as well.)&lt;br&gt;
&lt;br&gt;
Thanks very much,&lt;br&gt;
Tess</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 12:22:26 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691693</link>
      <author>Ashish Uthama</author>
      <description>On Mon, 02 Nov 2009 17:15:21 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Using the low-level HDF5 functions in Matlab, I have generated some HDF5  &lt;br&gt;
&amp;gt; files with several datasets that are each 512x512x1410.  I need to be  &lt;br&gt;
&amp;gt; able to read subsets of these different layers.  Looks like hdf5read  &lt;br&gt;
&amp;gt; does not have subsetting capabilities like hdfread, so I am guessing I  &lt;br&gt;
&amp;gt; need to use low-level functions such as H5D.read.  How do I translate  &lt;br&gt;
&amp;gt; something like the following high level hdfread call into those HDF5  &lt;br&gt;
&amp;gt; low-level functions?:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; data=hdfread('filename','/dataset_name','Index',{[start],[stride],[size]});&lt;br&gt;
&amp;gt; e.g.&lt;br&gt;
&amp;gt; sst=hdfread(file,'/WeeklySST','Index',{[1 1 999],[1 1 1],[512 512 1]});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; (Chunk size is set to 512x512x1, but I need to read across those  &lt;br&gt;
&amp;gt; boundaries as well.)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks very much,&lt;br&gt;
&amp;gt; Tess&lt;br&gt;
&lt;br&gt;
Tess,&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
HDF5 (1.6)&lt;br&gt;
&lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 12:24:02 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691694</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 07:22:26 -0500, Ashish Uthama  &lt;br&gt;
&amp;lt;first.last@mathworks.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; On Mon, 02 Nov 2009 17:15:21 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Using the low-level HDF5 functions in Matlab, I have generated some  &lt;br&gt;
&amp;gt;&amp;gt; HDF5 files with several datasets that are each 512x512x1410.  I need to  &lt;br&gt;
&amp;gt;&amp;gt; be able to read subsets of these different layers.  Looks like hdf5read  &lt;br&gt;
&amp;gt;&amp;gt; does not have subsetting capabilities like hdfread, so I am guessing I  &lt;br&gt;
&amp;gt;&amp;gt; need to use low-level functions such as H5D.read.  How do I translate  &lt;br&gt;
&amp;gt;&amp;gt; something like the following high level hdfread call into those HDF5  &lt;br&gt;
&amp;gt;&amp;gt; low-level functions?:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; data=hdfread('filename','/dataset_name','Index',{[start],[stride],[size]});&lt;br&gt;
&amp;gt;&amp;gt; e.g.&lt;br&gt;
&amp;gt;&amp;gt; sst=hdfread(file,'/WeeklySST','Index',{[1 1 999],[1 1 1],[512 512 1]});&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; (Chunk size is set to 512x512x1, but I need to read across those  &lt;br&gt;
&amp;gt;&amp;gt; boundaries as well.)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks very much,&lt;br&gt;
&amp;gt;&amp;gt; Tess&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Tess,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; HDF5 (1.6)&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 12:27:58 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691695</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 07:22:26 -0500, Ashish Uthama  &lt;br&gt;
&amp;lt;first.last@mathworks.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; On Mon, 02 Nov 2009 17:15:21 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Using the low-level HDF5 functions in Matlab, I have generated some  &lt;br&gt;
&amp;gt;&amp;gt; HDF5 files with several datasets that are each 512x512x1410.  I need to  &lt;br&gt;
&amp;gt;&amp;gt; be able to read subsets of these different layers.  Looks like hdf5read  &lt;br&gt;
&amp;gt;&amp;gt; does not have subsetting capabilities like hdfread, so I am guessing I  &lt;br&gt;
&amp;gt;&amp;gt; need to use low-level functions such as H5D.read.  How do I translate  &lt;br&gt;
&amp;gt;&amp;gt; something like the following high level hdfread call into those HDF5  &lt;br&gt;
&amp;gt;&amp;gt; low-level functions?:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; data=hdfread('filename','/dataset_name','Index',{[start],[stride],[size]});&lt;br&gt;
&amp;gt;&amp;gt; e.g.&lt;br&gt;
&amp;gt;&amp;gt; sst=hdfread(file,'/WeeklySST','Index',{[1 1 999],[1 1 1],[512 512 1]});&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; (Chunk size is set to 512x512x1, but I need to read across those  &lt;br&gt;
&amp;gt;&amp;gt; boundaries as well.)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks very much,&lt;br&gt;
&amp;gt;&amp;gt; Tess&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Tess,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; HDF5 (1.6)&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
Sorry, that went out before I could complete it.&lt;br&gt;
&lt;br&gt;
The above examples are for MATLAB R2009b and earlier, it would help to  &lt;br&gt;
have a quick look at&lt;br&gt;
&lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/README.txt&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/README.txt&lt;/a&gt;&lt;br&gt;
to figure out the correct way to specify the start/stride/count arguments.&lt;br&gt;
&lt;br&gt;
Please use the 1.8 link for 10a.&lt;br&gt;
&lt;br&gt;
You could look at the checksum example for specifying chunking.&lt;br&gt;
&lt;br&gt;
HTH</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 19:11:03 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691808</link>
      <author>Tess </author>
      <description>Thanks; I've seen these examples but haven't been able to get them to apply to my problem successfully.  Is 'hyperslab' just a fancy word for subset or chunk of the data?  Does it matter at all how the data set is chunked?&lt;br&gt;
&lt;br&gt;
I ran the following code and received the following error:&lt;br&gt;
fileID=H5F.open(file);&lt;br&gt;
dset=H5D.open(fileID,'/WeeklySST'); % this is a 53x512x512 data set which I &lt;br&gt;
% read successfully as a whole using H5D.read&lt;br&gt;
space=H5D.get_space(dset);&lt;br&gt;
start=[0 0 0];&lt;br&gt;
stride=[50 50 50] % making it symmetrical b/c I'm still figuring out how HDF5 flips&lt;br&gt;
% dimensions&lt;br&gt;
count=[]; block=[]; % &quot;If count and block are specified as [], the count and block&lt;br&gt;
% size default to a single element.&quot;&lt;br&gt;
H5S.select(space,'H5S_SELECT_SET',start,stride,count,block);&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; hdf5lib2&lt;br&gt;
The HDF5 library encountered an error:  &quot;unable to set hyperslab selection&quot;&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; H5S.select_hyperslab at 35&lt;br&gt;
H5ML.hdf5lib2('H5Sselect_hyperslab', spaceID, op, start, stride, count, block);&lt;br&gt;
&lt;br&gt;
I am running 7.8.0 R2009a.&lt;br&gt;
&lt;br&gt;
Thanks again,&lt;br&gt;
Tess&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.u2tjkwbva5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Tue, 03 Nov 2009 07:22:26 -0500, Ashish Uthama  &lt;br&gt;
&amp;gt; &amp;lt;first.last@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; On Mon, 02 Nov 2009 17:15:21 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Using the low-level HDF5 functions in Matlab, I have generated some  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; HDF5 files with several datasets that are each 512x512x1410.  I need to  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; be able to read subsets of these different layers.  Looks like hdf5read  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; does not have subsetting capabilities like hdfread, so I am guessing I  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; need to use low-level functions such as H5D.read.  How do I translate  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; something like the following high level hdfread call into those HDF5  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; low-level functions?:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; data=hdfread('filename','/dataset_name','Index',{[start],[stride],[size]});&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; e.g.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; sst=hdfread(file,'/WeeklySST','Index',{[1 1 999],[1 1 1],[512 512 1]});&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; (Chunk size is set to 512x512x1, but I need to read across those  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; boundaries as well.)&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Thanks very much,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Tess&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Tess,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; HDF5 (1.6)&lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/h5ex_d_hyper.m&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Sorry, that went out before I could complete it.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The above examples are for MATLAB R2009b and earlier, it would help to  &lt;br&gt;
&amp;gt; have a quick look at&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/README.txt&quot;&gt;http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples-1.6/README.txt&lt;/a&gt;&lt;br&gt;
&amp;gt; to figure out the correct way to specify the start/stride/count arguments.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Please use the 1.8 link for 10a.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You could look at the checksum example for specifying chunking.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; HTH</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 20:10:23 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691823</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 14:11:03 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Thanks; I've seen these examples but haven't been able to get them to  &lt;br&gt;
&amp;gt; apply to my problem successfully.  Is 'hyperslab' just a fancy word for  &lt;br&gt;
&amp;gt; subset or chunk of the data?  Does it matter at all how the data set is  &lt;br&gt;
&amp;gt; chunked?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I ran the following code and received the following error:&lt;br&gt;
&amp;gt; fileID=H5F.open(file);&lt;br&gt;
&amp;gt; dset=H5D.open(fileID,'/WeeklySST'); % this is a 53x512x512 data set  &lt;br&gt;
&amp;gt; which I&lt;br&gt;
&amp;gt; % read successfully as a whole using H5D.read&lt;br&gt;
&amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; start=[0 0 0];&lt;br&gt;
&amp;gt; stride=[50 50 50] % making it symmetrical b/c I'm still figuring out how  &lt;br&gt;
&amp;gt; HDF5 flips&lt;br&gt;
&amp;gt; % dimensions&lt;br&gt;
&amp;gt; count=[]; block=[]; % &quot;If count and block are specified as [], the count  &lt;br&gt;
&amp;gt; and block&lt;br&gt;
&amp;gt; % size default to a single element.&quot;&lt;br&gt;
&amp;gt; H5S.select(space,'H5S_SELECT_SET',start,stride,count,block);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; hdf5lib2&lt;br&gt;
&amp;gt; The HDF5 library encountered an error:  &quot;unable to set hyperslab  &lt;br&gt;
&amp;gt; selection&quot;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; H5S.select_hyperslab at 35&lt;br&gt;
&amp;gt; H5ML.hdf5lib2('H5Sselect_hyperslab', spaceID, op, start, stride, count,  &lt;br&gt;
&amp;gt; block);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am running 7.8.0 R2009a.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks again,&lt;br&gt;
&amp;gt; Tess&lt;br&gt;
&lt;br&gt;
1.&lt;br&gt;
As I understand it, chunking is defined on the internals of the file, i.e  &lt;br&gt;
how the data is stored/organized internally in the file. This appears to  &lt;br&gt;
be something required to enable 'extendible' data sets.&lt;br&gt;
&lt;a href=&quot;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&quot;&gt;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
A hyperslab is what you appear to think of as a 'chunk of data'. It is a  &lt;br&gt;
subset of the data. I dont think the chunking of the file matters when you  &lt;br&gt;
are reading a hyperslab.&lt;br&gt;
&lt;br&gt;
I am sure there is more info somewhere in the HDF documentation.&lt;br&gt;
&lt;br&gt;
2. Using [] results in the arguments defaulting to a single element. Thats  &lt;br&gt;
not what you want if you want to select a single element (look at code  &lt;br&gt;
below)&lt;br&gt;
&lt;br&gt;
3. You need to use H5S.select_hyperslab&lt;br&gt;
&lt;br&gt;
4. You need to specify a memory space ID which matches the size of the  &lt;br&gt;
data selected (see code)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Heres something which might help you understand better and get started  &lt;br&gt;
with your own code:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
%hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512])); %used to  &lt;br&gt;
create sample data, each element ought to be unique&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
space=H5D.get_space(dset);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
start=[7 18 26]; %zero based!&lt;br&gt;
stride=[1 1 1];&lt;br&gt;
count=[1 1 1]; block=[ ];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),...   %-1 to  &lt;br&gt;
take care of 0 based indexing&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fliplr(stride),fliplr(count),fliplr(block));                  %fliplr  &lt;br&gt;
to take care of row/column major reversal (please see the ReadMe.txt in my  &lt;br&gt;
previous post)&lt;br&gt;
mem_space = H5S.create_simple(3, fliplr(count), []);  %see Readme.txt for  &lt;br&gt;
explanation on need for flipping&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&lt;br&gt;
H5D.close(dset);&lt;br&gt;
H5S.close(space);&lt;br&gt;
H5S.close(mem_space);&lt;br&gt;
H5F.close(fileID);&lt;br&gt;
&lt;br&gt;
disp(rdata)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
%Cross check with the expected element:&lt;br&gt;
r=hdf5read('o.h5','/DS1');&lt;br&gt;
r(7,18,26)</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 20:55:17 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691837</link>
      <author>Tess </author>
      <description>I think you hit on it with #4 -- I didn't know how to set the memory space.  &lt;br&gt;
&lt;br&gt;
Apologies for accidentally leaving out the &quot;_hyperslab&quot; in &quot;H5S.select_hyperslab&quot; when copying from my workspace.&lt;br&gt;
&lt;br&gt;
Just to be clear, I already wrote these files to be chunked -- that's not the issue.  The issue is whether a file needs to be written with hyperslabs in order to use H5S.select_hyperslab, etc. to read hyperslabs?  Should I be using H5S.select_elements instead if I wrote the dataset to the file in one piece originally?&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.u2t4zlc7a5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Tue, 03 Nov 2009 14:11:03 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks; I've seen these examples but haven't been able to get them to  &lt;br&gt;
&amp;gt; &amp;gt; apply to my problem successfully.  Is 'hyperslab' just a fancy word for  &lt;br&gt;
&amp;gt; &amp;gt; subset or chunk of the data?  Does it matter at all how the data set is  &lt;br&gt;
&amp;gt; &amp;gt; chunked?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I ran the following code and received the following error:&lt;br&gt;
&amp;gt; &amp;gt; fileID=H5F.open(file);&lt;br&gt;
&amp;gt; &amp;gt; dset=H5D.open(fileID,'/WeeklySST'); % this is a 53x512x512 data set  &lt;br&gt;
&amp;gt; &amp;gt; which I&lt;br&gt;
&amp;gt; &amp;gt; % read successfully as a whole using H5D.read&lt;br&gt;
&amp;gt; &amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; &amp;gt; start=[0 0 0];&lt;br&gt;
&amp;gt; &amp;gt; stride=[50 50 50] % making it symmetrical b/c I'm still figuring out how  &lt;br&gt;
&amp;gt; &amp;gt; HDF5 flips&lt;br&gt;
&amp;gt; &amp;gt; % dimensions&lt;br&gt;
&amp;gt; &amp;gt; count=[]; block=[]; % &quot;If count and block are specified as [], the count  &lt;br&gt;
&amp;gt; &amp;gt; and block&lt;br&gt;
&amp;gt; &amp;gt; % size default to a single element.&quot;&lt;br&gt;
&amp;gt; &amp;gt; H5S.select(space,'H5S_SELECT_SET',start,stride,count,block);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using ==&amp;gt; hdf5lib2&lt;br&gt;
&amp;gt; &amp;gt; The HDF5 library encountered an error:  &quot;unable to set hyperslab  &lt;br&gt;
&amp;gt; &amp;gt; selection&quot;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Error in ==&amp;gt; H5S.select_hyperslab at 35&lt;br&gt;
&amp;gt; &amp;gt; H5ML.hdf5lib2('H5Sselect_hyperslab', spaceID, op, start, stride, count,  &lt;br&gt;
&amp;gt; &amp;gt; block);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am running 7.8.0 R2009a.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thanks again,&lt;br&gt;
&amp;gt; &amp;gt; Tess&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1.&lt;br&gt;
&amp;gt; As I understand it, chunking is defined on the internals of the file, i.e  &lt;br&gt;
&amp;gt; how the data is stored/organized internally in the file. This appears to  &lt;br&gt;
&amp;gt; be something required to enable 'extendible' data sets.&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&quot;&gt;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; A hyperslab is what you appear to think of as a 'chunk of data'. It is a  &lt;br&gt;
&amp;gt; subset of the data. I dont think the chunking of the file matters when you  &lt;br&gt;
&amp;gt; are reading a hyperslab.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am sure there is more info somewhere in the HDF documentation.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2. Using [] results in the arguments defaulting to a single element. Thats  &lt;br&gt;
&amp;gt; not what you want if you want to select a single element (look at code  &lt;br&gt;
&amp;gt; below)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3. You need to use H5S.select_hyperslab&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 4. You need to specify a memory space ID which matches the size of the  &lt;br&gt;
&amp;gt; data selected (see code)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Heres something which might help you understand better and get started  &lt;br&gt;
&amp;gt; with your own code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512])); %used to  &lt;br&gt;
&amp;gt; create sample data, each element ought to be unique&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
&amp;gt; dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
&amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; start=[7 18 26]; %zero based!&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 1 1]; block=[ ];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),...   %-1 to  &lt;br&gt;
&amp;gt; take care of 0 based indexing&lt;br&gt;
&amp;gt;      fliplr(stride),fliplr(count),fliplr(block));                  %fliplr  &lt;br&gt;
&amp;gt; to take care of row/column major reversal (please see the ReadMe.txt in my  &lt;br&gt;
&amp;gt; previous post)&lt;br&gt;
&amp;gt; mem_space = H5S.create_simple(3, fliplr(count), []);  %see Readme.txt for  &lt;br&gt;
&amp;gt; explanation on need for flipping&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5D.close(dset);&lt;br&gt;
&amp;gt; H5S.close(space);&lt;br&gt;
&amp;gt; H5S.close(mem_space);&lt;br&gt;
&amp;gt; H5F.close(fileID);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; disp(rdata)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %Cross check with the expected element:&lt;br&gt;
&amp;gt; r=hdf5read('o.h5','/DS1');&lt;br&gt;
&amp;gt; r(7,18,26)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 21:09:01 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691843</link>
      <author>Tess </author>
      <description>I just ran your code and realized that while you defined the memory space to be rank 3, [x y z], the output is only one value.  The way you've defined start, stride and count, you should have ended up with a 1x3 vector.  I need to be able to subset, say, a [1x512x512] slice of data.&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.u2t4zlc7a5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Tue, 03 Nov 2009 14:11:03 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks; I've seen these examples but haven't been able to get them to  &lt;br&gt;
&amp;gt; &amp;gt; apply to my problem successfully.  Is 'hyperslab' just a fancy word for  &lt;br&gt;
&amp;gt; &amp;gt; subset or chunk of the data?  Does it matter at all how the data set is  &lt;br&gt;
&amp;gt; &amp;gt; chunked?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I ran the following code and received the following error:&lt;br&gt;
&amp;gt; &amp;gt; fileID=H5F.open(file);&lt;br&gt;
&amp;gt; &amp;gt; dset=H5D.open(fileID,'/WeeklySST'); % this is a 53x512x512 data set  &lt;br&gt;
&amp;gt; &amp;gt; which I&lt;br&gt;
&amp;gt; &amp;gt; % read successfully as a whole using H5D.read&lt;br&gt;
&amp;gt; &amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; &amp;gt; start=[0 0 0];&lt;br&gt;
&amp;gt; &amp;gt; stride=[50 50 50] % making it symmetrical b/c I'm still figuring out how  &lt;br&gt;
&amp;gt; &amp;gt; HDF5 flips&lt;br&gt;
&amp;gt; &amp;gt; % dimensions&lt;br&gt;
&amp;gt; &amp;gt; count=[]; block=[]; % &quot;If count and block are specified as [], the count  &lt;br&gt;
&amp;gt; &amp;gt; and block&lt;br&gt;
&amp;gt; &amp;gt; % size default to a single element.&quot;&lt;br&gt;
&amp;gt; &amp;gt; H5S.select(space,'H5S_SELECT_SET',start,stride,count,block);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using ==&amp;gt; hdf5lib2&lt;br&gt;
&amp;gt; &amp;gt; The HDF5 library encountered an error:  &quot;unable to set hyperslab  &lt;br&gt;
&amp;gt; &amp;gt; selection&quot;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Error in ==&amp;gt; H5S.select_hyperslab at 35&lt;br&gt;
&amp;gt; &amp;gt; H5ML.hdf5lib2('H5Sselect_hyperslab', spaceID, op, start, stride, count,  &lt;br&gt;
&amp;gt; &amp;gt; block);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am running 7.8.0 R2009a.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thanks again,&lt;br&gt;
&amp;gt; &amp;gt; Tess&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1.&lt;br&gt;
&amp;gt; As I understand it, chunking is defined on the internals of the file, i.e  &lt;br&gt;
&amp;gt; how the data is stored/organized internally in the file. This appears to  &lt;br&gt;
&amp;gt; be something required to enable 'extendible' data sets.&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&quot;&gt;http://www.zib.de/zibdoc/zib/mpp/prog/hdf5/Tutor/extend.html&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; A hyperslab is what you appear to think of as a 'chunk of data'. It is a  &lt;br&gt;
&amp;gt; subset of the data. I dont think the chunking of the file matters when you  &lt;br&gt;
&amp;gt; are reading a hyperslab.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am sure there is more info somewhere in the HDF documentation.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2. Using [] results in the arguments defaulting to a single element. Thats  &lt;br&gt;
&amp;gt; not what you want if you want to select a single element (look at code  &lt;br&gt;
&amp;gt; below)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3. You need to use H5S.select_hyperslab&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 4. You need to specify a memory space ID which matches the size of the  &lt;br&gt;
&amp;gt; data selected (see code)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Heres something which might help you understand better and get started  &lt;br&gt;
&amp;gt; with your own code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512])); %used to  &lt;br&gt;
&amp;gt; create sample data, each element ought to be unique&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
&amp;gt; dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
&amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; start=[7 18 26]; %zero based!&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 1 1]; block=[ ];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),...   %-1 to  &lt;br&gt;
&amp;gt; take care of 0 based indexing&lt;br&gt;
&amp;gt;      fliplr(stride),fliplr(count),fliplr(block));                  %fliplr  &lt;br&gt;
&amp;gt; to take care of row/column major reversal (please see the ReadMe.txt in my  &lt;br&gt;
&amp;gt; previous post)&lt;br&gt;
&amp;gt; mem_space = H5S.create_simple(3, fliplr(count), []);  %see Readme.txt for  &lt;br&gt;
&amp;gt; explanation on need for flipping&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5D.close(dset);&lt;br&gt;
&amp;gt; H5S.close(space);&lt;br&gt;
&amp;gt; H5S.close(mem_space);&lt;br&gt;
&amp;gt; H5F.close(fileID);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; disp(rdata)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %Cross check with the expected element:&lt;br&gt;
&amp;gt; r=hdf5read('o.h5','/DS1');&lt;br&gt;
&amp;gt; r(7,18,26)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 21:11:07 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691844</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 15:55:17 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; I think you hit on it with #4 -- I didn't know how to set the memory  &lt;br&gt;
&amp;gt; space.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Apologies for accidentally leaving out the &quot;_hyperslab&quot; in  &lt;br&gt;
&amp;gt; &quot;H5S.select_hyperslab&quot; when copying from my workspace.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Just to be clear, I already wrote these files to be chunked -- that's  &lt;br&gt;
&amp;gt; not the issue.  The issue is whether a file needs to be written with  &lt;br&gt;
&amp;gt; hyperslabs in order to use H5S.select_hyperslab, etc. to read  &lt;br&gt;
&amp;gt; hyperslabs?  Should I be using H5S.select_elements instead if I wrote  &lt;br&gt;
&amp;gt; the dataset to the file in one piece originally?&lt;br&gt;
&lt;br&gt;
I am curious to know why you enabled chunking when you were writing?&lt;br&gt;
&lt;br&gt;
I hope you got my point earlier that chunking and hyperslabs are not the  &lt;br&gt;
same. Chunking has to do with how HDF5 library internally organizes parts  &lt;br&gt;
of the dataset. Hyperslab concept is at the application level, it is  &lt;br&gt;
independent of the chunking in the file.&lt;br&gt;
&lt;br&gt;
Have a quick look at '4.5 Storage strategies' here  &lt;br&gt;
&lt;a href=&quot;http://www.hdfgroup.org/HDF5/doc/UG/UG_frame10Datasets.html&quot;&gt;http://www.hdfgroup.org/HDF5/doc/UG/UG_frame10Datasets.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
You can use any of he selection/read methods (hyperslab/elements) on a  &lt;br&gt;
HDF5 file irrespective of how it was written/chunked.</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 21:19:27 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691848</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 16:09:01 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; I just ran your code and realized that while you defined the memory  &lt;br&gt;
&amp;gt; space to be rank 3, [x y z], the output is only one value.  The way  &lt;br&gt;
&amp;gt; you've defined start, stride and count, you should have ended up with a  &lt;br&gt;
&amp;gt; 1x3 vector.  I need to be able to subset, say, a [1x512x512] slice of  &lt;br&gt;
&amp;gt; data.&lt;br&gt;
&lt;br&gt;
With this:&lt;br&gt;
start=[7 18 26];&lt;br&gt;
stride=[1 1 1];&lt;br&gt;
count=[1 1 1]; block=[ ];&lt;br&gt;
&lt;br&gt;
Count is the number of data points along that specific dimension.&lt;br&gt;
Total number of actual data points selected is 1x1x1 = 1&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Did you consider using this:&lt;br&gt;
&lt;br&gt;
start=[1 1 1];&lt;br&gt;
stride=[1 1 1];&lt;br&gt;
count=[1 512 512]; block=[];</description>
    </item>
    <item>
      <pubDate>Tue, 03 Nov 2009 21:48:02 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#691853</link>
      <author>Tess </author>
      <description>Yes!  Done.  Thank you.&lt;br&gt;
&lt;br&gt;
This is a long shot, but do you have any idea whether there is any intention to add the subsetting functionality of hdfread (for HDF4) into hdf5read?  That was so much simpler.&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.u2t76p0ya5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Tue, 03 Nov 2009 16:09:01 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I just ran your code and realized that while you defined the memory  &lt;br&gt;
&amp;gt; &amp;gt; space to be rank 3, [x y z], the output is only one value.  The way  &lt;br&gt;
&amp;gt; &amp;gt; you've defined start, stride and count, you should have ended up with a  &lt;br&gt;
&amp;gt; &amp;gt; 1x3 vector.  I need to be able to subset, say, a [1x512x512] slice of  &lt;br&gt;
&amp;gt; &amp;gt; data.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; With this:&lt;br&gt;
&amp;gt; start=[7 18 26];&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 1 1]; block=[ ];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Count is the number of data points along that specific dimension.&lt;br&gt;
&amp;gt; Total number of actual data points selected is 1x1x1 = 1&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Did you consider using this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; start=[1 1 1];&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 512 512]; block=[];</description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 13:36:42 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#692028</link>
      <author>Ashish Uthama</author>
      <description>On Tue, 03 Nov 2009 16:48:02 -0500, Tess  &amp;lt;tess.brandon@noaa.gov&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Yes!  Done.  Thank you.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is a long shot, but do you have any idea whether there is any  &lt;br&gt;
&amp;gt; intention to add the subsetting functionality of hdfread (for HDF4) into  &lt;br&gt;
&amp;gt; hdf5read?  That was so much simpler.&lt;br&gt;
&lt;br&gt;
The team may be aware of this need, I'll pass on the message.</description>
    </item>
    <item>
      <pubDate>Fri, 05 Mar 2010 14:48:24 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#723745</link>
      <author>Luis Fernandes</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
I've tried your solution with R2008a (7.6.0) to adapt for my case and I get an error:&lt;br&gt;
&lt;br&gt;
??? Could not read dataset.&lt;br&gt;
&lt;br&gt;
So, I've copied your code to see if it was my problem and I get the same error.&lt;br&gt;
&lt;br&gt;
??? Could not read dataset.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; testhyperslab at 20&lt;br&gt;
rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&lt;br&gt;
testhyperslab is the m file with your code as shown below: &lt;br&gt;
&lt;br&gt;
hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512]))&lt;br&gt;
&lt;br&gt;
fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
space=H5D.get_space(dset);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
start=[7 18 26]; %zero based!&lt;br&gt;
stride=[1 1 1];&lt;br&gt;
count=[1 1 1]; block=[ ];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),... %-1 totake care of 0 based indexing&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fliplr(stride),fliplr(count),fliplr(block)); %fliplrto take care of row/column major reversal (please see the ReadMe.txt in myprevious post&lt;br&gt;
mem_space = H5S.create_simple(3, fliplr(count), []); %see Readme.txt forexplanation on need for flipping&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&lt;br&gt;
H5D.close(dset);&lt;br&gt;
H5S.close(space);&lt;br&gt;
H5S.close(mem_space);&lt;br&gt;
H5F.close(fileID);&lt;br&gt;
&lt;br&gt;
disp(rdata)&lt;br&gt;
&lt;br&gt;
If I read the entire array it's fine, but with hyperslab I get the &quot;can't read dataset&quot; error. Any idea on what's going on? Thanks!&lt;br&gt;
Luis</description>
    </item>
    <item>
      <pubDate>Fri, 05 Mar 2010 19:36:27 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#723873</link>
      <author>John Evans</author>
      <description>&quot;Luis Fernandes&quot; &amp;lt;luisfernandes77@hotmail.com&amp;gt; wrote in message &amp;lt;hmr5jo$5dc$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've tried your solution with R2008a (7.6.0) to adapt for my case and I get an error:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??? Could not read dataset.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So, I've copied your code to see if it was my problem and I get the same error.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??? Could not read dataset.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; testhyperslab at 20&lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; testhyperslab is the m file with your code as shown below: &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512]))&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
&amp;gt; dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
&amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; start=[7 18 26]; %zero based!&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 1 1]; block=[ ];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),... %-1 totake care of 0 based indexing&lt;br&gt;
&amp;gt;      fliplr(stride),fliplr(count),fliplr(block)); %fliplrto take care of row/column major reversal (please see the ReadMe.txt in myprevious post&lt;br&gt;
&amp;gt; mem_space = H5S.create_simple(3, fliplr(count), []); %see Readme.txt forexplanation on need for flipping&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H5D.close(dset);&lt;br&gt;
&amp;gt; H5S.close(space);&lt;br&gt;
&amp;gt; H5S.close(mem_space);&lt;br&gt;
&amp;gt; H5F.close(fileID);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; disp(rdata)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If I read the entire array it's fine, but with hyperslab I get the &quot;can't read dataset&quot; error. Any idea on what's going on? Thanks!&lt;br&gt;
&amp;gt; Luis&lt;br&gt;
&lt;br&gt;
Try using 'H5ML_DEFAULT' instead of 'H5T_NATIVE_INT'.</description>
    </item>
    <item>
      <pubDate>Fri, 05 Mar 2010 19:38:41 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#723874</link>
      <author>Ashish Uthama</author>
      <description>On Fri, 05 Mar 2010 09:48:24 -0500, Luis Fernandes  &lt;br&gt;
&amp;lt;luisfernandes77@hotmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I've tried your solution with R2008a (7.6.0) to adapt for my case and I  &lt;br&gt;
&amp;gt; get an error:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Could not read dataset.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So, I've copied your code to see if it was my problem and I get the same  &lt;br&gt;
&amp;gt; error.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Could not read dataset.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; testhyperslab at 20&lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; testhyperslab is the m file with your code as shown below:  &lt;br&gt;
&amp;gt; hdf5write('o.h5','/DS1',reshape(1:53*512*512,[53 512 512]))&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; fileID=H5F.open('o.h5','H5F_ACC_RDONLY','H5P_DEFAULT');&lt;br&gt;
&amp;gt; dset=H5D.open(fileID,'/DS1'); % this is a 53x512x512 data set&lt;br&gt;
&amp;gt; space=H5D.get_space(dset);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; start=[7 18 26]; %zero based!&lt;br&gt;
&amp;gt; stride=[1 1 1];&lt;br&gt;
&amp;gt; count=[1 1 1]; block=[ ];&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; H5S.select_hyperslab(space,'H5S_SELECT_SET',fliplr(start-1),... %-1  &lt;br&gt;
&amp;gt; totake care of 0 based indexing&lt;br&gt;
&amp;gt;      fliplr(stride),fliplr(count),fliplr(block)); %fliplrto take care of  &lt;br&gt;
&amp;gt; row/column major reversal (please see the ReadMe.txt in myprevious post&lt;br&gt;
&amp;gt; mem_space = H5S.create_simple(3, fliplr(count), []); %see Readme.txt  &lt;br&gt;
&amp;gt; forexplanation on need for flipping&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5T_NATIVE_INT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; H5D.close(dset);&lt;br&gt;
&amp;gt; H5S.close(space);&lt;br&gt;
&amp;gt; H5S.close(mem_space);&lt;br&gt;
&amp;gt; H5F.close(fileID);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; disp(rdata)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If I read the entire array it's fine, but with hyperslab I get the  &lt;br&gt;
&amp;gt; &quot;can't read dataset&quot; error. Any idea on what's going on? Thanks!&lt;br&gt;
&amp;gt; Luis&lt;br&gt;
&lt;br&gt;
For 8a, try replacing the read with:&lt;br&gt;
rdata = H5D.read(dset,'H5ML_DEFAULT',mem_space,space,'H5P_DEFAULT');</description>
    </item>
    <item>
      <pubDate>Mon, 08 Mar 2010 08:58:05 -0500</pubDate>
      <title>Re: reading HDF5 dataset subset</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264785#724376</link>
      <author>Luis Fernandes</author>
      <description>&lt;br&gt;
&amp;gt; For 8a, try replacing the read with:&lt;br&gt;
&amp;gt; rdata = H5D.read(dset,'H5ML_DEFAULT',mem_space,space,'H5P_DEFAULT');&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thanks, it worked. </description>
    </item>
  </channel>
</rss>

