Main Content

Dimension Scale (H5DS)

Dimension scale associated with dataset dimensions

Description

Use the MATLAB® HDF5 dimension scale interface, H5DS, to access information about and manipulate HDF5 dimension scales.

An HDF5 dimension scale is an HDF5 dataset that is associated with the dimension of another dataset. A common case is a 2-dimensional array that has spatial information, such as latitude and longitude, associated with it.

Functions

H5DS.attach_scale

Attach dimension scale to specific dataset dimension

H5DS.attach_scale(dsID,dimscaleID,dim) attaches a dimension scale dimscaleID to the dimension dim of the dataset specified by dsID.

Note

The ordering of the dimension scale indices is the same as in the HDF5 library C API. For more information, see Report Data Set Dimensions.

H5DS.detach_scale

Detach dimension scale from specific dataset dimension

H5DS.detach_scale(dsID,dimscaleID,dim) detaches dimension scale dimscaleID from the dimension dim of the dataset specified by dsID.

Note

The ordering of the dimension scale indices is the same as in the HDF5 library C API. For more information, see Report Data Set Dimensions.

H5DS.get_label

Label from specific dataset dimension

label = H5DS.get_label(dsID,dim) returns the label for dimension dim of the dataset specified by dsID.

Note

The ordering of the dimension scale indices is the same as in the HDF5 library C API. For more information, see Report Data Set Dimensions.

H5DS.get_num_scales

Number of scales attached to dataset dimension

numscales = H5DS.get_num_scales(dsID,dim) determines the number of dimension scales that are attached to dimension dim of the dataset specified by dsID.

H5DS.get_scale_name

Name of dimension scale

dimscalename = H5DS.get_scale_name(dimscaleID) retrieves the name of the dimension scale dimscaleID.

H5DS.is_scale

Determine if dataset is a dimension scale

output = H5DS.is_scale(dsID) returns a positive value if the dataset specified by dsID is a dimension scale, and 0 if it is not.

H5DS.iterate_scales

Iterate on scales attached to dataset dimension

[status,idxOut,opdataOut] = H5DS.iterate_scales(dsID,dim,idxIn,fnc,opdataIn) iterates over the scales attached to dimension dim of the dataset specified by dsID to perform a common operation whose function handle is fnc.

 Details

H5DS.set_label

Set label for dataset dimension

H5DS.set_label(dsID,dim,label) sets a label for dimension dim of the dataset specified by dsID.

Note

The ordering of the dimension scale indices is the same as in the HDF5 library C API. For more information, see Report Data Set Dimensions.

H5DS.set_scale

Convert dataset to dimension scale

H5DS.set_scale(dsID,dimname) converts the dataset specified by dsID to a dimension scale with name dimname.

Examples

expand all

Open the file example.h5 and the dataset /g4/world.

fid = H5F.open("example.h5");
dsID = H5D.open(fid,"/g4/world");

Read the label of the dataset, and then close all identifiers.

label = H5DS.get_label(dsID,0);
H5D.close(dsID);
H5F.close(fid);

Create a writeable copy of the file example.h5.

plist = "H5P_DEFAULT";
srcFile = fullfile(matlabroot,"toolbox","matlab","demos","example.h5");
copyfile(srcFile,"myfile.h5");
fileattrib("myfile.h5","+w");
fid = H5F.open("myfile.h5","H5F_ACC_RDWR",plist);

Open the dataset /g4/world and set its labels for dimensions 0 and 1.

dsID = H5D.open(fid,"/g4/world",plist);
H5DS.set_label(dsID,0,"latitude");
H5DS.set_label(dsID,1,"longitude");

Close all identifiers.

H5D.close(dsID);
H5F.close(fid);

Version History

Introduced before R2006a