C中访问Matlab数据文件Mat的方式:
mat数据格式是matlab的数据存储的标准格式。
(1)首先将Mat.h所在的includes文件夹加到Vs2005的include配置中:
Tools-Options-Projects and Solutions-VC++ Directories
在show derectories for:中选择includes file
将Matlab安装目录下的extern/include添加到其中。
(2)#include<mat.h>
(3)常见函数:
matopen 打开mat文件
matclose 关闭mat文件
magetfp 取得mat文件的c语言句柄
matGetArray 取得一个数组
/*
* Open a MAT-file "filename" using mode "mode". Return
* a pointer to a MATFile for use with other MAT API functions.
*
* Current valid entries for "mode" are
* "r" == read only.
* "w" == write only (deletes any existing file with name <filename>).
* "w4" == as "w", but create a MA