Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

matOpen (C and Fortran) - Open MAT-file

C Syntax

#include "mat.h"
MATFile *matOpen(const char *filename, const char *mode);

Fortran Syntax

mwPointer matOpen(filename, mode)
character*(*) filename, mode

Arguments

filename

Name of file to open

mode

File opening mode. The following table lists valid values for mode.

r

Opens file for reading only; determines the current version of the MAT-file by inspecting the files and preserves the current version.

u

Opens file for update, both reading and writing. If the file does not exist, does not create a file (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

Opens file for writing only; deletes previous contents, if any.

w4

Creates a Level 4 MAT-file, compatible with MATLAB Versions 4 software and earlier.

wL

Opens file for writing character data using the default character set for your system. Use MATLAB Version 6 or 6.5 software to read the resulting MAT-file.

If you do not use the wL mode switch, MATLAB writes character data to the MAT-file using Unicode® character encoding by default.

wz

Opens file for writing compressed data.

w7.3

Creates a MAT-file in an HDF5-based format that can store objects that occupy more than 2 GB.

Returns

File handle, or NULL in C (0 in Fortran) if the open fails.

Description

This routine opens a MAT-file for reading and writing.

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

Examples

See the following examples in matlabroot/extern/examples/eng_mat.

See Also

matClose

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS