How to supress S Function generation when using coder.ceval and coder.target

8 ビュー (過去 30 日間)
Daniel
Daniel 2023 年 3 月 1 日
回答済み: Daniel 2023 年 3 月 3 日
Right now, I am working to use embedded coder to generate C code to execute on an embedded target using the slbuild command. The way I call custom C code from simulink is to use a MATLAB defined user function with the following statement.
if coder.target('MATLAB')
%Do nothing
else
%Call custom embedded C function called function_name
coder.updateBuildInfo('addSourceFiles','functions.c');
coder.cinclude('functions.h');
coder.ceval('function_name');
end
This works fine for very simple C functions, but I am running into trouble with larger C functions because embedded coder is still trying to create an S Function to simulate this block and the "function_name". I think all I need to do is turn the S Function generation off... how do I do that? Is there a command line option, model configuration box, or a coder.target statement that could do this?
In previous versions of MATLAB, I've also used the following and never had this problem, but when I try that here, it is still trying to generate the S function.
if coder.target('Rtw')
%call C function
coder.ceval('function_name')
else
%Do Nothing
end

採用された回答

Daniel
Daniel 2023 年 3 月 3 日
This worked for anyone else out there who has run into this problem. This prevents the attempt of simulating an S function for C code that is meant to run on an embedded target.
if (coder.target('MATLAB') | coder.target('SystemC') | coder.target('MEX') | coder.target('Sfun'))
%Do nothing here
else
%do coder.ceval statements here
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by