run a c++ function from matlab 2010b

I currently have matlab 2010b. To analyze my dataset vector I would like to pass the vector into a c++ library of functions for analysis, and then have the resulting vector returned. I know that matlab2012 comes with the coder commands for doing something similar, however, if I am using matlab2010b, how can this be done?
Ideally I would want this: 1) write a vector in matlab 2) send vector as a parameter into a c++ function 3) have the c++ function return my answer back to Matlab.
Thanks.

Réponses (2)

Walter Roberson
Walter Roberson le 23 Juil 2012

0 votes

This turns out not to have anything to do with MATLAB Compiler or MATLAB Coder. Instead, have a look at loadlibrary()
Note that the function directly called must use C datatypes and C linkage conventions, C++'s extern "C" . That function can then call into true C++.
Kaustubha Govind
Kaustubha Govind le 23 Juil 2012

0 votes

How about creating a C++ MEX file so that your C++ function can be used like any other MATLAB function?

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by