%% Specify data set to read
% Call hdfinfo to retrieve information about the contents of the HDF file.

fileinfo = hdfinfo('sd.hdf')

%
% Extract the structure containing information about the particular data set you want to import from the data returned by hdfinfo. This example uses the structure in the SDS field to retrieve a scientific data set.

sds_info = fileinfo.SDS(2)

%
% Pass this structure to hdfread to import the data in the data set.

data = hdfread(sds_info);

% Copyright 2015 The MathWorks, Inc.