Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語
Справка Scilab >> 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

ВерсияОписание
5.5.0 HDF5 module introduced.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:13:25 CET 2017