Matlab Coder error in C++ code generation

I am building a pairs trading module where I am using the following line pfun = @(x) pairsFun(x, DATA1, DATA2, annual Scaling, cost);
this is probably creating a function handle pfun to function pairsfun where the next line [~,param] = parameterSweep(pfun,range);
passes the function as argument to another function parametersweep which loops to find maximum value of a variable. The code is taken from matlab pairs trading module.
The issue is when I am trying to generate codes for C++ using coder the line pfun = @(x) pairsFun(x, DATA1, DATA2, annual Scaling, cost); is generating an error : this kind of expression is not supported.
It would great if someone provides some direction.

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 26 Feb. 2013

0 Stimmen

Anonymous functions are not supported for codegen. You will have to work around this by using a function handle to a regular function or sub-function.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by