Passing By Reference Not Supported for Some Properties - MATLAB & Simulink (original) (raw)
Main Content
The code generator does not support passing a property by reference to an external function for these types of properties:
- A property with a get method or a set method.
- A property that uses validation functions.
- A System objectâ„¢ property with an attribute, such as
Logical
orPositiveInteger
, that constrains or modifies the property value.
Instead of passing a property by reference, save the property value in a temporary variable. Then, pass the temporary variable by reference to the external function. After the external function call, assign the temporary variable to the property. For example:
tmp = myObj.prop; coder.ceval('myFcn', coder.ref(tmp)); myObj.prop = tmp;
The assignment after the coder.ceval
call validates or modifies the property value according to the property access methods, validation functions, or attributes.
See Also
coder.ceval | coder.ref | coder.rref | coder.wref