www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ReadSubsetOfDataInDataSetExample.m

    %% Read Subset of Data in Data Set
%%
% Retrieve info about the example file, |example.hdf|.

% Copyright 2015 The MathWorks, Inc.

fileinfo = hdfinfo('example.hdf');
%%
% Retrieve information about Scientific Data Set in |example.hdf|.
data_set_info = fileinfo.SDS;
%%
% Check the size of the data set.
data_set_info.Dims.Size
%%
% Read a subset of the data in the data set using the
% |'index'| parameter with |hdfread|. This example specifies a starting index of |[3 3]|,
% an interval of 1 between values (|[]| meaning the default value of 1),
% and a length of 10 rows and 2 columns.
data = hdfread(data_set_info,'Index',{[3 3],[],[10 2]});
data(:,1)
%%
data(:,2)