Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

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

Ajuda do Scilab >> HDF5 files > 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

VersãoDescrição
5.5.0 HDF5 module introduced.
Report an issue
<< h5is* tests HDF5 files 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:
Mon Jan 03 14:35:25 CET 2022