我是 Visual Studio 和 C/C++ 新手...尽管我曾在 MATLAB 中工作过...
我正在尝试使用 MATLAB 帮助中给出的 MAT API 加载 mat 文件,但即使对于下面给出的简单代码,它也在编译,但解决方案未构建,并且给出了 4 个相同类型的错误。我已包含所有内容lib 和头文件作为附加 lib 和包含文件夹...
需要严重的帮助...谢谢
错误1错误LNK2019:函数_main test2.obj test2中引用了无法解析的外部符号_mxFree
错误2错误LNK2019:函数_main test2.obj test2中引用了无法解析的外部符号_matGetVariable
其余两个错误也是其他 MAT-API 的错误...
enter code here
#include <mat.h>
#include <stdio.h>
void main()
{
MATFile *pmat;
const char **dir;
int ndir;
int i;
mxArray *pfp;
pmat=matOpen("data3.mat","r");
/* get directory of MAT-file */
dir = (const char **)matGetDir(pmat, &ndir);
printf("Directory of %s:\n","data3.mat");
for (i=0; i < ndir; i++)
{
printf("%s\n",dir[i]);
}
//to get the pointer of data from file
pfp=matGetVariable(pmat, "fp");
mxFree(dir);
}
最佳答案
关于c - 在C中读取Mat文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6274429/