Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Read MAT-File in C/C++

The matdgns.c example illustrates how to use the library routines to read and diagnose a MAT-file. To see the code, open the file in MATLAB® Editor.

After building the program, run the application. This program reads the mattest.mat MAT-file created by the Create MAT-File in C or C++ example. To run the application, depending on your platform, either double-click its icon or enter matdgns at the system prompt.

matdgns mattest.mat
Reading file mattest.mat...
 
Directory of mattest.mat:
GlobalDouble
LocalString
LocalDouble
 
Examining the header for each variable:
According to its header, array GlobalDouble has 2 dimensions
  and was a global variable when saved
According to its header, array LocalString has 2 dimensions
  and was a local variable when saved
According to its header, array LocalDouble has 2 dimensions
  and was a local variable when saved
 
Reading in the actual array contents:
According to its contents, array GlobalDouble has 2 dimensions
  and was a global variable when saved
According to its contents, array LocalString has 2 dimensions
  and was a local variable when saved
According to its contents, array LocalDouble has 2 dimensions
  and was a local variable when saved
Done

Related Examples

Was this topic helpful?