HDF5OpenFile
HDF5OpenFile [ /I /P=pathName /R /Z ] fileID [as fileNameStr ]
The HDF5OpenFile operation opens an existing HDF5 file for reading or for reading and writing.
HDF5OpenFile returns a file reference number via the fileID parameter. You pass this file ID to subsequent HDF5 operation and function calls.
When you are finished with the file you must call HDF5CloseFile.
To create a new HDF5 file you must call HDF5CreateFile instead of calling HDF5OpenFile.
Parameters
fileID is the name of an Igor local variable NVAR referencing a global variable. HDF5OpenFile returns an HDF5 file ID 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 HDF5OpenFile 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, HDF5OpenFile displays an Open File dialog. HDF5OpenFile 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
| /I | Interactive. Displays the Open File dialog to get the file name and path. | |
| /P=pathName | pathName is the name of an Igor symbolic path that specifies the directory to look in for fileNameStr. | |
| /R | Opens the file for read-only. If omitted, the file is opened for read/write. | |
| /Z | Suppress error generation. Use this if you want to handle errors yourself. | |
Details
If you do not intend to write to the file, use the /R flag. Otherwise you will get an error if you try to load a read-only file or one that is in a directory for which you do not have write permission.
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.
HDFOpenFile sets the following output variables:
Output Variables
| V_Flag | Set to zero if the operation succeeds, non-zero if it fails. | |
| S_path | Set 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_fileName | Set to the name of the loaded file. | |
Examples
Variable fileID
HDF5OpenFile /R fileID as "C:Data:test.h5" // Windows using Macintosh path
HDF5OpenFile /R fileID as "C:\\Data\\test.h5" // Windows using Windows path
HDF5CloseFile fileID
See Also
HDF5CreateFile, HDF5CloseFile, HDF5FlushFile, HDF5LoadData, HDF5LoadGroup, HDF5SaveData, HDF5SaveGroup, HDF5CreateGroup, HDF5OpenGroup, HDF5CloseGroup