Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> HDF5 Management > H5 Objects

H5 Objects

Describe the properties of the different H5 objects

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:

  • name: the filename;

  • size: the file size;

  • version: the HDF5 library version;

  • root: the root group "/".

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:

  • attributes: the attributes names;

  • groups: the subgroups names;

  • datasets: the datasets names;

  • types: the types names;

  • externals: the external links names;

  • softs: the soft links names;

  • danglings: the dangling links names;

  • hards: the hard links names;

  • links: the links names and types;

  • name: the group name;

  • path: the group path.

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:

  • attributes: the attributes names;

  • type: the dataset type;

  • dataspace: the dataset space;

  • data: the dataset data;

  • name: the group name;

  • path: the group path.

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:

  • dims: the dataspace dimensions;

  • extents: the dataspace max dimensions;

  • type: the dataspace type: "scalar", "simple" or "null";

  • name: the parent name.

  • path: the parent path.

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:

  • type: the attribute type;

  • dataspace: the attribute dataspace;

  • data: the attribute data;

  • name: the attribute name.

  • path: the parent path.

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:

  • class: the type class;

  • type: the type name;

  • size: the size in bytes;

  • nativetype: the native type associated with this type;

  • nativesize: the size of the native type.

  • name: the parent name.

  • path: the parent path.

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

  • h5attr — Create an attribute
  • h5close — Close a HDF5 object
  • h5cp — Copy an object
  • h5dataset — Create a dataset and write the data
  • h5dump — Dump the content of an H5 object on the standard output stream
  • h5exists — Test the existence of named object
  • h5flush — Flush all the buffers associated with a file
  • h5get — Get a named object
  • h5group — Create a group
  • h5isAttr — Check if the HDF5 object is an attribute
  • h5isFile — Check if the HDF5 object is a file
  • h5isGroup — Check if the HDF5 object is a group
  • h5isRef — Check if the HDF5 object is a reference object
  • h5isSet — Check if the HDF5 object is a dataset
  • h5isSpace — Check if the HDF5 object is a dataspace
  • h5isType — Check if the HDF5 object is a type
  • h5label — Label a dataset
  • h5ln — Link an object to another one
  • h5ls — List the content of an HDF5 object (group or dataset)
  • h5mount — Mount a file on a group
  • h5mv — Move an object
  • h5open — Open an HDF5 file
  • h5read — Read the data of an HDF5 attribute
  • h5rm — Remove elements from an HDF5 file
  • h5umount — Unmount a previously mounted file.
  • h5write — Create a dataset (if it does not exist) and write the data
  • h5writeattr — Write an attribute in a group or a dataset

History

VersionDescription
5.5.0 HDF5 module introduced.
Report an issue
<< h5mv HDF5 Management h5open >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 02 13:54:34 CEST 2014