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

- h5group
- h5dataset

## History

5.5.0 HDF5 module introduced.