Using matOpen in Visual Studio 2012

1 vue (au cours des 30 derniers jours)
Fabian Jonsson
Fabian Jonsson le 18 Déc 2013
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?

Réponses (0)

Catégories

En savoir plus sur Adding custom doc dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by