Main Content

hdfinfo

Information about HDF4 or HDF-EOS2 file

Syntax

S = hdfinfo(filename)
S = hdfinfo(filename,mode)

Description

S = hdfinfo(filename) returns a structure S whose fields contain information about the contents of an HDF4 or HDF-EOS2 file. Specify filename as a character vector or string scalar containing the name of the HDF4 or HDF-EOS2 file.

S = hdfinfo(filename,mode) reads the file as an HDF4 file if mode is 'hdf', or as an HDF-EOS2 file if mode is 'eos'. If mode is 'eos', only HDF-EOS data objects are queried. To retrieve information on the entire contents of a file containing both HDF4 and HDF-EOS objects, mode must be 'hdf'.

Note

hdfinfo can be used on HDF4 files or HDF-EOS2 files. To get information about an HDF5 file, use h5info.

The set of fields in the returned structure S depends on the individual file. Fields that can be present in the S structure are shown in the following table.

Mode

Field Name

Description

Return Type

HDF

Attributes

Attributes of the data set

Structure array

 

Description

Annotation description

Cell array

 

Filename

Name of the file

Character vector

 

Label

Annotation label

Cell array

 

Raster8

Description of 8-bit raster images

Structure array

 

Raster24

Description of 24-bit raster images

Structure array

 

SDS

Description of scientific data sets

Structure array

 

Vdata

Description of Vdata sets

Structure array

 

Vgroup

Description of Vgroups

Structure array

EOS

Filename

Name of the file

Character vector

 

Grid

Grid data

Structure array

 

Point

Point data

Structure array

 

Swath

Swath data

Structure array

Those fields in the table above that contain structure arrays are further described in the tables shown below.

Fields Common to Returned Structure Arrays

Structure arrays returned by hdfinfo contain some common fields. These are shown in the table below. Not all structure arrays will contain all of these fields.

Field Name

Description

Data Type

Attributes

Data set attributes. Contains fields Name and Value.

Structure array

Description

Annotation description

Cell array

Filename

Name of the file

Character vector

Label

Annotation label

Cell array

Name

Name of the data set

Character vector

Rank

Number of dimensions of the data set

Double

Ref

Data set reference number

Double

Type

Type of HDF or HDF-EOS object

Character vector

Fields Specific to Certain Structures

Structure arrays returned by hdfinfo also contain fields that are unique to each structure. These are shown in the tables below.

Fields of the Attribute Structure

Field Name

Description

Data Type

Name

Attribute name

Character vector

Value

Attribute value or description

Numeric or Text

Fields of the Raster8 and Raster24 Structures

Field Name

Description

Data Type

HasPalette

1 (true) if the image has an associated palette, otherwise 0 (false) (8-bit only)

Logical

Height

Height of the image, in pixels

Number

Interlace

Interlace mode of the image (24-bit only)

Character vector

Name

Name of the image

Character vector

Width

Width of the image, in pixels

Number

Fields of the SDS Structure

Field Name

Description

Data Type

DataType

Data precision

Character vector

Dims

Dimensions of the data set. Contains fields Name, DataType, Size, Scale, and Attributes. Scale is an array of numbers to place along the dimension and demarcate intervals in the data set.

Structure array

Index

Index of the SDS

Number

Fields of the Vdata Structure

Field Name

Description

Data Type

DataAttributes

Attributes of the entire data set. Contains fields Name and Value.

Structure array

Class

Class name of the data set

Character vector

Fields

Fields of the Vdata. Contains fields Name and Attributes.

Structure array

NumRecords

Number of data set records

Double

IsAttribute

1 (true) if Vdata is an attribute, otherwise 0 (false)

Logical

Fields of the Vgroup Structure

Field Name

Description

Data Type

Class

Class name of the data set

Character vector

Raster8

Description of the 8-bit raster image

Structure array

Raster24

Description of the 24-bit raster image

Structure array

SDS

Description of the Scientific Data sets

Structure array

Tag

Tag of this Vgroup

Number

Vdata

Description of the Vdata sets

Structure array

Vgroup

Description of the Vgroups

Structure array

Fields of the Grid Structure

Field Name

Description

Data Type

Columns

Number of columns in the grid

Number

DataFields

Description of the data fields in each Grid field of the grid. Contains fields Name, Rank, Dims, NumberType, FillValue, and TileDims.

Structure array

LowerRight

Lower right corner location, in meters

Number

Origin Code

Origin code for the grid

Number

PixRegCode

Pixel registration code

Number

Projection

Projection code, zone code, sphere code, and projection parameters of the grid. Contains fields ProjCode, ZoneCode, SphereCode, and ProjParam.

Structure

Rows

Number of rows in the grid

Number

UpperLeft

Upper left corner location, in meters

Number

Fields of the Point Structure

Field Name

Description

Data Type

Level

Description of each level of the point. Contains fields Name, NumRecords, FieldNames, DataType, and Index.

Structure

Fields of the Swath Structure

Field Name

Description

Data Type

DataFields

Data fields in the swath. Contains fields Name, Rank, Dims, NumberType, and FillValue.

Structure array

GeolocationFields

Geolocation fields in the swath. Contains fields Name, Rank, Dims, NumberType, and FillValue.

Structure array

IdxMapInfo

Relationship between indexed elements of the geolocation mapping. Contains fields Map and Size.

Structure

MapInfo

Relationship between data and geolocation fields. Contains fields Map, Offset, and Increment.

Structure

Examples

To retrieve information about the file example.hdf,

fileinfo = hdfinfo('example.hdf')

fileinfo = 
    Filename: 'example.hdf'
         SDS: [1x1 struct]
       Vdata: [1x1 struct]

And to retrieve information from this about the scientific data set in example.hdf,

sds_info = fileinfo.SDS

sds_info = 
       Filename: 'example.hdf'
           Type: 'Scientific Data Set'
           Name: 'Example SDS'
           Rank: 2
       DataType: 'int16'
     Attributes: []
           Dims: [2x1 struct]
          Label: {}
    Description: {}
          Index: 0

Version History

Introduced before R2006a

See Also