User`s manual

6 Importing and Exporting Data
6-16
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” on page 6-28.
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.
matcreat
Creating file mattest.mat...
To verify that the MAT-file has been created, at the MATLAB prompt enter
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
Reading a MAT-File in C
This sample program illustrates how to use the library routines to read and
diagnose a MAT-file.
/* $Revision: 1.1 $ */
/*
* MAT-file diagnose program
*
* Calling syntax:
*
* matdgns <matfile.mat>
*
* It diagnoses the MAT-file named <matfile.mat>.
*
* This program demonstrates the use of the following functions:
*