Using the C++ Math Library    

Importing and Exporting MAT-File Data 

The MATLAB C++ Math Library provides two functions, load() and save(), that let you import mwArray variables from a MAT-file and export mwArray variables to a MAT-file. Because MATLAB also reads and writes MAT-files, you can use load() and save() to share data with MATLAB applications or with other applications developed with the MATLAB C++ or C Math Library.

A MAT-file is a binary, machine-dependent file. However, it can be transported between machines because of a machine signature in its file header. The MATLAB C++ Math Library checks the signature when it loads variables from a MAT-file and, if a signature indicates that a file is foreign (file was saved on a different architecture than the one on which it is being loaded), performs the necessary conversion.


 Example - Using File I/O Functions (ex6.cpp) Exporting Array Data to a MAT-File