Ode45 matlab coder function handle

1 回表示 (過去 30 日間)
laminarflow
laminarflow 2015 年 11 月 20 日
回答済み: Ryan Livingston 2015 年 12 月 31 日
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 日
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

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by