Main Content

Exception by function

Description

Specify how input array data is handled by each external C/C++ function and class method.

Category: Simulation Target

Settings

Specify how input array data is handled by each external C/C++ function and class method in your custom code. The array layout specified for an individual function or class method takes precedence over the option specified in Default function array layout. Use these options to add or remove the array layout setting for an individual function or class method:

green plus sign Add

Add custom C/C++ function or class method and specify its array layout setting. To specify a class method, use the syntax ClassName::MethodName.

red letter x Remove

Remove custom C/C++ function or class method from the exception list and apply default array layout to the function or class method.

Tip

If you do not see a list of your custom code functions in the Exception by function dialog, close the dialog, click Validate custom code, and click Exception by function again.

Command-Line Information

Parameter: CustomCodeFunctionArrayLayout
Type: structure array
Value: structure with 'FunctionName' and 'ArrayLayout' fields. 'ArrayLayout' can be 'Column-major', 'Row-major' or 'Any'.
Default: ' '

Example

Consider the model foo_model. If you have external C/C++ functions and class methods that you interface with the model, execute these MATLAB® commands to specify array layouts for the functions and class methods.

arrayLayout(1).FunctionName = 'MyCFunction1';
arrayLayout(1).ArrayLayout = 'Column-major';
arrayLayout(2).FunctionName = 'MyCFunction2';
arrayLayout(2).ArrayLayout = 'Row-major';
arrayLayout(3).FunctionName = 'myClass::getboolRes';
arrayLayout(3).ArrayLayout = 'Row-major';
set_param('foo_model', 'CustomCodeFunctionArrayLayout', arrayLayout)

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo recommendation
Safety precautionNo recommendation

Related Topics