Routines (alphabetical) > Routines: H > HDF5 Routines > H5_PUTDATA

# H5_PUTDATA

This procedure writes a new dataset to either a new or existing HDF5 file.

Note: Because HDF5 does not provide a mechanism to remove a dataset from a file at this time, it is not possible to put a dataset into a file if the ID to that dataset already exists.

## Examples

Write a new dataset (stored in the variable named `data`) to the file `temp.h5` that's located in the `group1/mydata` directory.

H5_PUTDATA, 'temp.h5', 'group1/mydata', data

## Syntax

H5_PUTDATA, Filename, StrID, Data

## Arguments

### Filename

A string denoting the name of the target HDF5 file to which IDL will write the dataset.

### StrID

The full identifier giving the path to the new dataset within the file. If any groups in the path do not currently exist, IDL will create them along with the new dataset.

### Data

Any IDL variable containing the data to be written to the dataset.

Note: Pointers and objects do not work in this instance as the IDL variable needs to be "data."

## Keywords

None

## Version History

8.3 | Introduced

## See Also

H5_GETDATA, H5_LIST