External Interfaces Previous page   Next Page

Examples of MAT-Files

This section includes C and Fortran examples of writing, reading, and diagnosing MAT-files. The examples cover the following topics:

Creating a MAT-File in C

This sample program illustrates how to use the library routines to create a MAT-file that can be loaded into MATLAB. The program also demonstrates how to check the return values of MAT-function calls for read or write failures.

To produce an executable version of this example program, compile the file and link it with the appropriate library. Details on how to compile and link MAT-file programs on the various platforms are discussed in the section, Compiling and Linking MAT-File Programs.

Once you have compiled and linked your MAT-file program, you can run the stand-alone application you have just produced. This program creates a MAT-file, mattest.mat, that can be loaded into MATLAB. To run the application, depending on your platform, either double-click on its icon or enter matcreat at the system prompt.

To verify that the MAT-file has been created, at the MATLAB prompt enter


Previous page  Finding Associated Files Reading a MAT-File in C Next page

© 1994-2005 The MathWorks, Inc.