<< h5mv Fichiers HDF5 h5open >>

Scilab Help >> Fichiers HDF5 > H5 Objects

H5 Objects

Describe the properties of the different H5 objects

Contents

Description

H5 objects have some accessible properties. All the properties name are case insensitive (except for the path or objects names).

H5 File

The following properties can be accessed:

If the field name starts with '/', then it is considered as a path and the returned value is the H5 object corresponding to this path.

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");

// a is a file
h5isFile(a)

// Access to the properties
a.name, a.size, a.version, a.root

// Open the dataset x
a("/x")

// Free all the resources
h5close(a);

H5 Group

The following properties can be accessed:

If the field name is not in the previous list, then it is considered as a local path to another H5 object.

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
root = a.root;

// root is a group
h5isGroup(root)

// Access to the properties
root.name, root.path, root.datasets, root.attributes

// Open the dataset x
dset_x = root.x

// Free all the resources
h5close(a);

H5 Dataset

The following properties can be accessed:

If the field name is not in the previous list, then it is considered as an attribute name.

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
dset_x = a.root.x;

// dset_x is a dataset
h5isSet(dset_x)

// Access to the properties
dset_x.attributes, dset_x.type, dset_x.dataspace, dset_x.data

// Open the attribute x
attr_x = dset_x.SCILAB_Class

// Free all the resources
h5close(a);

H5 Dataspace

The following properties can be accessed:

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
dspace_x = a.root.x.dataspace;

// dspace_x is a space
h5isSpace(dspace_x)

// Access to the properties
dspace_x.dims, dspace_x.extents, dspace_x.type

// Free all the resources
h5close(a);

H5 Attribute

The following properties can be accessed:

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
attr_x = a.root.x.SCILAB_Class;

// attr_x is an attribute
h5isAttr(attr_x)

// Access to the properties
attr_x.type, attr_x.dataspace, attr_x.data

// Free all the resources
h5close(a);

H5 Type

The following properties can be accessed:

x = [1 2;3 4];
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
type_x = a.root.x.type;

// type_x is a type
h5isType(type_x)

// Access to the properties
type_x.class, type_x.type, type_x.size, type_x.nativetype, type_x.nativesize,

// Free all the resources
h5close(a);

H5 Reference

H5 Reference object wrap an hypermatrix object where elements are a reference to an H5 object.

x = list([1 2;3 4], "Hello", uint32(123));
save(TMPDIR + "/x.sod", "x");
a = h5open(TMPDIR + "/x.sod");
dims_x = a.root.x.dataspace.dims
ref_x = a.root.x.data;

// ref_x is a reference
h5isRef(ref_x)

// Get the 3 elements
x1 = ref_x(1), x2 = ref_x(2), x3 = ref_x(3)

// Get the data
x1.data, x2.data, x3.data

// Free all the resources
h5close(a);

See also

History

VersionDescription
5.5.0 HDF5 module introduced.

Report an issue
<< h5mv Fichiers HDF5 h5open >>