c - 在C中读取Mat文件

标签 c matlab

我是 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/

相关文章:

c - 结构员工 {} 比较结构 {} 员工

c - 通过 FIFO 传递结构

Matlab:如何根据均值和标准差绘制正态曲线

matlab - 在 Matlab 中解析 PC-Axis (.px) 文件

matlab - 使用 MATLAB 实现 SIFT 和 SURF 特征提取

ios - 如何从 FFT 中获得更精确的输出?

c - 从文件或路径获取 FILE 扩展名

c - 从源代码构建 R 包 krb5

matlab 以编程方式为图形分配 "export settings"-> "load settings from"

matlab - 透明绘图