External Interfaces Reference Previous page   Next Page
matOpen

Open MAT-file

C Syntax

Arguments

filename
   Name of file to open.

mode
   File opening mode. Valid values for mode are:

r
Open file for reading only; determines the current version of the MAT-file by inspecting the files and preserves the current version.
u
Open file for update, both reading and writing, but does not create the file if the file does not exist (equivalent to the r+ mode of fopen); determines the current version of the MAT-file by inspecting the files and preserves the current version.
w
Open file for writing only; deletes previous contents, if any.
w4
Create a Level 4 MAT-file, compatible with MATLAB Versions 4 and earlier.
wL
Open file for writing character data using the default character set for your system. The resulting MAT-file can be read with MATLAB version 6 or 6.5.
If you do not use the wL mode switch, MATLAB writes character data to the MAT-file using Unicode encoding by default.
wz
Open file for writing compressed data.

Description

This routine allows you to open MAT-files for reading and writing.

matOpen opens the named file and returns a file handle, or NULL if the open fails.

See Writing Character Data in the External Interfaces documentation for more information on how MATLAB uses character data encoding.

Examples

See matcreat.c and matdgns.c in the eng_mat subdirectory of the examples directory for sample programs that illustrate how to use the MATLAB MAT-file routines in a C program.


Previous page  matGetVariableInfo matPutArray (Obsolete) Next page

© 1994-2005 The MathWorks, Inc.