Including mat.h and using in a C++ program

25 Ansichten (letzte 30 Tage)
Elena  Cantoni
Elena Cantoni am 12 Sep. 2012
Hello, to use variables from a MATLAB file calling it in a C/C++ program one has to add this inclusion at the beginning: #include "mat.h" ... But my compiler says: "mat.h, no such file or directory". It seems something like my MATLAB version hasn't got mat.h in its libraries... Is it possible? If yes, how can I get it? Otherwise, is the command right? Or is there something else I have to do? Thanks a lot! Elena

Akzeptierte Antwort

José-Luis
José-Luis am 12 Sep. 2012
Bearbeitet: José-Luis am 18 Sep. 2012
mat. h is a header file, not a library. You need to tell your compiler where it's located. You could probably get that info from Matlab's command line:
your_path = [matlabroot '/extern/include']
How to properly include that header file would depend on the IDE you are using (most often an option under something like project properties/search directories). Alternatively you could #include the complete file path, but that's an ugly solution, especially since you might end up needing other headers that are in that folder.

Weitere Antworten (1)

Kaustubha Govind
Kaustubha Govind am 12 Sep. 2012
You need to use the Options File provided for compiling MAT-file applications. Please follow Compiling and Linking MAT-File Programs to find the exact compiler/linker commands to be used.

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by