Ode45 matlab coder function handle

Hi,
I am trying to generate a mex-file for the ode45 function. The problem is that when I try to auto-define the inputs, the coder won't take the function handle:
''Class function_handle is not supported by coder.type''
How can I fix this?
Thanks

답변 (1개)

Ryan Livingston
Ryan Livingston 2015년 12월 31일

0 개 추천

You cannot pass a function handle directly to a MEX file generated by MATLAB Coder. Just write a wrapper that calls ode45 in the way you like:
function y = foo(x)
%#codegen
y = ode45(@someFun,...);
and then generate code for foo:
codegen foo -args 1:10

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

질문:

2015년 11월 20일

답변:

2015년 12월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by