Using matOpen in Visual Studio 2012
1 view (last 30 days)
Show older comments
I'm trying to include the libmat library to be able to read .mat files in C++, however I've not been able to link it properly eventhough I've set it up exactly the same way as I have other libraries. I've tried two different approaches, but both fail.
First of all, I've added the following links in the project preferences:
VC++ Directories > Library Directories: C:\MATLABR2011b_x86\extern\lib\win32\microsoft
VC++ Directories > Include Directories: C:\MATLABR2011b_x86\extern\include
C/C++ > Additional Include Directories: C:\MATLABR2011b_x86\extern\include
Linker > Input > Additional Dependecies: libmat.lib; libmx.lib; libmex.lib
And added the libmat.dll, libmex.dll and libmx.dll to the debug folder of the project.
--------------------------------------------------------------------------------
Method 1:
#include "mat.h"
MATFile* file = matOpen("examplefile.mat","r");
I then get the following error:
First-chance exception: Microsoft C++ exception: fl::i18n::MwLcDataNotFound
--------------------------------------------------------------------------------
Method 2:
#include "mat.h"
std::string DLLFilename = "libmat.dll";
HMODULE libHandle = LoadLibrary(DLLFilename.c_str());
// I can comment out the following lines and the error persists
MATFile *(*myMatOpen)(const char*, const char*);
myMatOpen = (MATFile*(*)(const char*, const char*))GetProcAddress(libHandle, "matOpen");
And I get the same error using this method.
What am I missing?
0 Comments
Answers (0)
See Also
Categories
Find more on Adding custom doc in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!