I have a function, call it foo(), that accepts a number of arguments as inputs. Say, in this case, the definition of foo()'s inputs look like this:
function [x] = foo(f,lb,ub)
where f is a function_handle, and lb and ub are doubles.
I would like to use the codegen() function in MATLAB R2017a to turn this into a MEX file. When I run coder.screener('foo'), I get the all clear, but I cannot figure out how to actually create the args input in the codegen function. For example:
codegen foo.m -args {{X},0,0}
In this case, {X} should be a function_handle type, but it appears that it is unsupported or not easily accessible. I do get the following error when I run the codegen function:
Function input at args{1} does not have a valid type.Caused by: Class function_handle is not supported by coder.Type.Use help codegen for more information on using this command.Error using codegen
Can I achieve what I am trying to do (create a MEX file of a function that requires a function_handle as an input argument) or is this still unsupported?
Best Answer