用c语言编写的读取mat文件(matlab矩阵)的程序,有错,求帮助

用c语言编写的读取mat文件(matlab矩阵)的程序,有错,求帮助,第1张

从错误提示上,就是两个变量未定义导致的链接错误

你先搜索整个工程,error提示中的两个变量在哪里用到

另外,也有可能是 include导入的头文件问题

比如没导入必要的库

或者是导入的库有问题

看你这段代码没有这两个变量,可能是其他文件或者使用的库的问题

导入的库也有依赖关系,使用前应该看看使用说明吧

还有其他可能就是,本机的环境变量设定的问题

信息不够,暂时只能帮你分析到这里

如果还有疑问,加QQ 11302106,把代码传过来,帮你解决

另外,验证的时候要写清楚 请求的原因

是。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

(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 ).

* "w4"   == as "w", but create a MATLAB 4.0 MAT-file.

* "w7.3" == as "w", but create a MATLAB 7.3 MAT-file.

* "u"    == update.  Read and write allowed, existing file is not deleted.

*

* Return NULL if an error occurs.

*/

EXTERN_C MATFile * matOpen(const char *filename, const char * mode)

/*

* Close a MAT-file opened with matOpen.

*

* Return zero for success, EOF on error.

*/

EXTERN_C int matClose(MATFile *pMF)

/*

* Write array value with the specified name to the MAT-file, deleting any

* previously existing variable with that name in the MAT-file.

*

* Return zero for success, nonzero for error.

*/

EXTERN_C int matPutVariable(

MATFile * pMF,

const char * name,

const mxArray * pA

)

/*

* Read the array value for the specified variable name from a MAT-file.

*

* Return NULL if an error occurs.

*/

EXTERN_C mxArray * matGetVariable(MATFile * pMF, const char * name)


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11233303.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-14
下一篇2023-05-14

发表评论

登录后才能评论

评论列表(0条)

    保存