Error when m-file calls cpp-file
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a folder that implements the Bayesian Color Constancy, and it contains .m files and .cpp files. When some .m file calls a .cpp file, MATLAB yields: ??? Undefined function or method ‹The functions' name› for input arguments of type ‹double›. although I have everything in path.
Do i need to install something special in order to make MATLAB recognize this file?
0 Commenti
Risposta accettata
José-Luis
il 2 Mag 2013
You cannot call directly cpp files from Matlab. You need to use mex to compile cpp file into a format that Matlab can understand.
doc mex
Once it is compiled you can call it directly from Matlab. As it stands, what the error message is telling you is that there is no function with that name that Matlab understand. The file might very well be there, but it is not possible to read it.
3 Commenti
José-Luis
il 2 Mag 2013
Have you tried reading the documentation? Please type
doc mex
in the command line.
In a perfect world, if everything is already set up right:
mex your_file.cpp
should suffice, and produce a function your_file() that you can then call from Matlab.
Please accept an answer if it helps you.
Più risposte (1)
José-Luis
il 2 Mag 2013
Are you using linux?
2 Commenti
José-Luis
il 2 Mag 2013
Then you need to compile it. I looked at the download and a compiled linux version is provided. There is a Makefile provided to help with the dependencies or whatnot. You should probably contact the author for help if you want to do in Windows.
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!