Main Content

h5readatt

Read attribute from HDF5 file

Description

example

attval = h5readatt(filename,loc,attr)retrieves the value of the specified attribute from the specified location in an HDF5 file.

Examples

collapse all

Read the attributeattr2from the root group of the HDF5 fileexample.h5.

val = h5readatt('example.h5','/','attr2')
val =2x2 int32 matrix0 2 1 3

Read the attributeunitsfrom the datasetlonin the HDF5 fileexample.h5.

val = h5readatt('example.h5','/g4/lon','units')
val = 'degrees_east'

Input Arguments

collapse all

File name, specified as a character vector or string scalar containing the name of an existing HDF5 file.

Depending on the location of your file,filenamecan take on one of these forms.

Location

Form

Current folder

Specify the name of the file infilename.

Example:'myFile.h5'

Other folders

If the file is not in the current folder or in a folder on the MATLAB®path, then specify the full or relative path name infilename.

Example:'C:\myFolder\myFile.h5'

Example:'myFolder\myFile.h5'

Remote Location

If the file is stored at a remote location, thenfilenamemust contain the full path of the file specified as a uniform resource locator (URL) of the form:

scheme_name://path_to_file/my_file.ext

Based on your remote location,scheme_namecan be one of the values in this table.

Remote Location scheme_name
Amazon S3™ s3
Windows Azure®Blob Storage wasb,wasbs
HDFS™ hdfs

For more information, seeWork with Remote Data.

Example:'s3://bucketname/path_to_file/myFile.h5'

Location in the file, specified as a character vector or string scalar containing the full path of an existing group or dataset to which the attribute belongs. To read an attribute from the root group of the file, specify'/'as the location.

Attribute name, specified as a character vector or string scalar containing the name of an attribute belonging to a group or dataset.

版本历史

Introduced in R2011a