coder.ceval を使用して生成された C ライブラリ関数を呼び出す MATLAB 関数を記述します。
function y = callmyabsval(y)
%#codegen% Check the target. Do not use coder.ceval if callmyabsval is% executing in MATLABif coder.target('MATLAB')
% Executing in MATLAB, call function myabsval
y = myabsval(y);
else% add the required include statements to generated function code
coder.updateBuildInfo('addIncludePaths','$(START_DIR)\codegen\lib\myabsval');
coder.cinclude('myabsval_initialize.h');
coder.cinclude('myabsval.h');
coder.cinclude('myabsval_terminate.h');
% Executing in the generated code. % Call the initialize function before calling the % C function for the first time
coder.ceval('myabsval_initialize');
% Call the generated C library function myabsval
y = coder.ceval('myabsval',y);
% Call the terminate function after% calling the C function for the last time
coder.ceval('myabsval_terminate');
end