Main Content

读取用 C/C++ 编写的 MAT 文件

matdgns.c 示例说明如何使用库例程来读取和诊断 MAT 文件。要查看代码,请在 MATLAB® 编辑器中打开文件

编译程序后,运行应用程序。此程序将读取在 C 或 C++ 中创建 MAT 文件示例所创建的 mattest.mat MAT 文件。要运行应用程序,请双击其图标或在系统提示符下输入 matdgns,具体取决于您的平台。

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

相关主题