Skip to main content

HDF5CreateFile

HDF5CreateFile [ /I /O /P=pathName /Z ] fileID as fileNameStr

The HDF5CreateFile operation creates a new HDF5 file or overwrites an existing HDF5 file if /O is used and then opens the file for read/write.

If the file already exists and /O is omitted, an error is returned.

Since HDF5CreateFile opens the file after creating it, do not call HDFOpenFile.

After calling HDF5CreateFile, use HDF5SaveData or HDF5SaveGroup to save data in the file. When you are finished with the file, call HDF5CloseFile.

Parameters

fileID is the name of an Igor local variable or NVAR referencing a global variable. HDF5CreateFile returns an HDF5 file ID number in the named variable. You pass this file ID to subsequent HDF5 operation and function calls and to HDF5CloseFile when you are finished with the file. If for some reason the HDF5CreateFile operation fails, fileID is set to zero.

fileNameStr is a full path to the HDF5 file, or a file name or partial path relative to the Igor symbolic path specified via /P.

If fileNameStr is omitted or is "" or the /I flag is used, HDF5CreateFile displays an Open File dialog. HDF5CreateFile also displays an Open File dialog if the fileNameStr and pathName do not fully specify the file of interest.

If you use a full or partial path for fileNameStr, see Path Separators for details on forming the path.

Flags

/IInteractive. Displays the Open File dialog to get the file name and path.
If you use /I and want the user to be able to overwrite an existing file then you must also use /O.
/OOverwrite the file if it already exists.
If the file already exists and /O is omitted, an error is returned.
/P=pathNamepathName is the name of an Igor symbolic path that specifies the directory to look in for fileNameStr.
/ZSuppress error generation. Use this if you want to handle errors yourself.

Details

When the current experiment is closed (via New Experiment, Open Experiment or Revert Experiment or by quitting Igor) Igor automatically closes all open HDF5 files.

Output Variables

HDFCreateFile sets the following output variables:

V_FlagSet to zero if the operation succeeds, non-zero if it fails.
S_pathSet to the path leading to the folder containing the loaded file. This is a system file path (e.g., "hd:FolderA:FolderB:"), not an Igor symbolic path. The path uses Macintosh HFS path syntax, even on Windows, and has a trailing colon.
S_fileNameSet to the name of the loaded file.

Examples

Variable fileID
HDF5CreateFile/P=<SymbolicPathName> fileID as "test.h5"
HDF5CreateFile fileID as "C:Data:test.h5" // Windows using Mac path
HDF5CreateFile fileID as "C:\\Data\\test.h5" // Windows using Windows path

See Also

HDF5OpenFile, HDF5CloseFile, HDF5FlushFile, HDF5SaveData, HDF5SaveGroup, HDF5CreateGroup, HDF5OpenGroup, HDF5CloseGroup