How to open .mat file in C
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to make c code to read a .mat file. Here it is:
#include <stdio.h>
#include "c:\MATLAB\R2015b-x64\extern\include\mat.h"
int main(){
MATFile * pMF;
printf("Abrindo arquivo .mat...\n"); /*check (1)*/
pMF = matOpen("teste.mat","r");
printf("Arquivo .mat aberto.\n"); /*check (2)*/
getch();
end
When I compile this in Visual Studio 2010, I get the following message:
matread.obj : error LNK2019: unresolved external symbol _matOpen referenced in function _main
matread.exe : fatal error LNK1120: 1 unresolved externals
I'm using VS 2010, which is not supported by R2015b (the indicated version is VS 2010 SP1). Could it be caused by a compatibility issue with this compiler, or it's just coding error?
Thanks in advance,
Porto
4 个评论
James Tursa
2017-4-4
编辑:James Tursa
2017-4-4
name.h files are text header files meant for the compiler. They are not compiled object library files meant for the linker. The library files meant for the linker would be ending in .lib for example. And you need to give these names to the linker ... not #include them as part of your source code.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!