# h5open

Open an HDF5 file

## Calling Sequence

                obj = h5open(filename [, access])
                obj = h5open(filename, access, driver [, driver_options...])

## Arguments

filename

  a string giving the filename

access

  A string giving the access mode to use

driver

  A string giving the driver name

driver_options

  A boolean or a double depending of the driver value

obj

  A H5Object corresponding to the open file

## Description

Open an HDF5 file in using the access mode (by default "a").

The access mode is one of the five values:

- "r": read only, the file must exist.
- "r+": read/write, the file must exist.
- "w": create file, truncate if exists.
- "w-": create file, fail if exists.
- "a": read/write if exists, create otherwise (default).

Several drivers can be used:

- "sec2": Unbuffered, using standard POSIX functions.
- "stdio": Uses functions from the standard C stdio.h to perform I/O.
- "core": Uses a file in memory (improves read/write). This driver has two options:
  - backingStore: a boolean, if %T (default), the changes are saved in the real file.
  - blockSize: a double: increment (in bytes) to use to increase buffer size (default 64K).
- "family": Allow to split the file when its size is greater than the option memberSize (a double, by default 2^31 -1). The filename must contain a %d which will be used to generate the family filenames.

## Examples

    x = 1:10;
    save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones

    // Open the created file
    a = h5open(TMPDIR + "/x.sod");

    // Dump the file content
    h5dump(a);

    // list the contents of the root element.
    h5ls(a)

    // Get the SOD version
    a.root.SCILAB_sod_version.data

    // or if the name contains 'invalid' chars
    a.root("SCILAB_sod_version").data

    // Get the content of the dataset x
    a.root.x.data

    // it is possible to open the dataset directly with its path
    // Subgroups or datasets are separated with '/'
    a("/x")

    // Free the resources
    h5close(a);

## See Also

- h5close

## History

5.5.0
HDF5 module introduced.