> For the complete documentation index, see [llms.txt](https://nelson-9.gitbook.io/nelson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nelson-9.gitbook.io/nelson/markdown/en/hdf5/h5writeatt.md).

# h5writeatt

Writes HDF5 attribute.

## 📝 Syntax

* h5writeatt(filename, location, attname, attvalue)
* h5writeatt(filename, location, attname, attvalue, 'TextEncoding', encoding)

## 📥 Input argument

* filename - a string: hdf5 filename.
* location - a string: full path identifying a group or variable.
* attname - a string: name of an attribute.
* attvalue - a value: supported types: double, uint64, uint32, uint16, uint8 single, int64, int32, int16, or int8.
* encoding - a string: 'system' or 'UTF-8' ('UTF-8' default).

## 📄 Description

h5writeatt writes attribute namedattname with the value attvalue to the HDF5 file.

## 💡 Example

```matlab
h5create([tempdir(), 'myfile.h5'],'/myDataset1',[10 20]);
h5writeatt([tempdir(), 'myfile.h5'],'/','creation_date', '26-Dec-2018 16:55:32')
```

## 🔗 See also

[h5readatt](/nelson/markdown/en/hdf5/h5readatt.md).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.0.0   | initial version |
