Optimization of function described in standalone code

2 vues (au cours des 30 derniers jours)
Alexander Efremov
Alexander Efremov le 24 Fév 2011
Hello. Here is the situation: I have described a function in C++ and I want to use my code with Optimization Toolbox algorithms. What is the shortest way to do that?

Réponse acceptée

Rakesh Kumar
Rakesh Kumar le 25 Fév 2011
You will have to create a C++ file (which is called MEX in MATLAB environment) that can be called directly from MATLAB. See some example here (look under 'Creating C/C++ Language MEX-Files'): http://www.mathworks.com/help/techdoc/matlab_external/exampleindex.html Your mex file will call the function you wrote (objective function).
Make sure that you can call your mex file without any error. Now, setup the optimization problem. Provide the name of this mex file to the optimization solver.

Plus de réponses (0)

Catégories

En savoir plus sur Problem-Based Optimization Setup 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