Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - English

Change language to:
Français - 日本語 - 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

Scilab Help >> HDF5 Management > h5attr

h5attr

Create an attribute

Syntax

h5attr(obj, location, name, data [, targetType])
h5attr(filename, location, name, data [, targetType])

Arguments

obj

a H5Object

location

a string giving the location in the object or in the file

name

a string giving the path to the new dataset

data

a Scilab data

targetType

a string giving the type of the target

filename

a string giving the filename

Description

Create a new named attribute based on the Scilab data passed as argument.

The target HDF5 type can be chosen in the list available in the HDF5 manual. Examples of this HDF5 type are "H5T_MIPS_U32" or "H5T_STD_B64BE", but shortcuts as "MIPS_U32" or "STD_B64BE" can also be used.

An attribute can be located in a group or in a dataset

Examples

x = 1:5 + %pi;
save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones

// We open the file
a = h5open(TMPDIR + "/x.sod");

// Add an attribute to the root element
h5attr(a, ".", "My Attribute", int8(123));

// Check
h5dump(a)

// ...or
a.root("My Attribute").data

// Add an attribute to the dataset named "x"
h5attr(a, "/x", "My Dataset Attribute", int16(321));

// Check
h5dump(a.root.x)

// We have finished so we free all the resources
h5close(a);

See also

History

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

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:
Tue Feb 14 15:02:49 CET 2017