Optimization of function described in standalone code

조회 수: 2 (최근 30일)
Alexander Efremov
Alexander Efremov 2011년 2월 24일
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?

채택된 답변

Rakesh Kumar
Rakesh Kumar 2011년 2월 25일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by