Main Content

Undefined function handling

Description

Specify the behavior of undefined functions in the C source code file of a model that contains C Caller, C Function, MATLAB Function, or MATLAB System block or a Stateflow® chart. If a function is declared in the source header file but not implemented in the source code, Simulink® behaves according to this setting.

Category: Simulation Target

Settings

Default: Filter out

Throw Error

Return error if a function in the C source code is undefined. A stub function is not generated automatically, but function is visible on the C Caller Port Specification table.

Filter out

Filter out any undefined functions in the C source code. A stub function is not generated automatically, and the function is not visible on the C caller Port Specification table.

If you have any undefined functions in the C source code and they are called in a model that uses a MATLAB Function or MATLAB System block or a Stateflow chart, Simulink returns an error. If the custom code to any of your blocks in your model has undefined functions, Simulink displays a warning.

Do not detect

Do not detect any undefined functions from the source code. A stub function is not generated automatically, but function is visible on the C Caller Port Specification table.

Use interface only

Detect any undefined functions from the C source code. Generate stub functions for the undefined functions and make them visible in the model and callable from Stateflow charts and C Function, MATLAB Function and MATLAB System blocks.

Command-Line Information

Parameter: CustomCodeUndefinedFunction
Type: character vector
Value: 'ThrowError' | 'FilterOut' | 'DoNotDetect' | 'UseInterfaceOnly'
Default: 'FilterOut'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo recommendation
Safety precautionNo recommendation

Related Topics