The matcreat.c example illustrates how to use the library routines to create a MAT-file that you can load into the MATLAB® workspace. The program also demonstrates how to check the return values of MAT-function calls for read or write failures. To see the code, open the fileopen the file in MATLAB Editor.
To produce an executable version of this program, compile the file and link it with the appropriate library. For details on platform specifics, see Compiling and Linking MAT-File Programs.
After compiling and linking your MAT-file program, you can run the standalone application you just produced. This program creates mattest.mat, a MAT-file that you can load into MATLAB. To run the application, depending on your platform, either double-click its icon or enter matcreat at the system prompt:
matcreat Creating file mattest.mat...
To verify the MAT-file, at the command prompt, type:
whos -file mattest.mat Name Size Bytes Class GlobalDouble 3x3 72 double array (global) LocalDouble 3x3 72 double array LocalString 1x43 86 char array Grand total is 61 elements using 230 bytes