Add argument configuration information for Simulink model
port to model-specific C function prototype
Syntax
addArgConf(obj, portName, category, argName, qualifier)
Description
addArgConf(obj, portName, category, argName, qualifier) method
adds argument configuration information for a port in your ERT-based Simulink® model
to a model-specific C function prototype. You specify the name of
the model port, the argument category ('Value' or 'Pointer'),
the argument name, and the argument type qualifier (for example, 'const').
The order of addArgConf calls determines
the argument position for the port in the function prototype, unless
you change the order by other means, such as the RTW.ModelSpecificCPrototype.setArgPosition method.
If a port has an existing argument configuration, subsequent
calls to addArgConf with the same port name overwrite
the previous argument configuration of the port.
Inputs
| obj | Handle to a model-specific C prototype function control object
previously returned by obj = RTW.ModelSpecificCPrototype or obj =
RTW.getFunctionSpecification(modelName). |
| portName | String specifying the unqualified name of an inport or outport
in your Simulink model. |
| category | String specifying the argument category, either 'Value' or 'Pointer'. |
| argName | String specifying a valid C identifier. |
| qualifier | String specifying the argument type qualifier: 'none', 'const', 'const
*', or 'const * const'. |
Examples
In the following example, you use the addArgConf method
to add argument configuration information for ports Input and Output in
an ERT-based version of rtwdemo_counter.
After executing these commands, click the Configure Model
Functions button on the Interface pane
of the Configuration Parameters dialog box to open the Model Interface
dialog box and confirm that the addArgConf commands
succeeded.
rtwdemo_counter
set_param(gcs,'SystemTargetFile','ert.tlc')
%% Create a function control object
a=RTW.ModelSpecificCPrototype
%% Add argument configuration information for Input and Output ports
addArgConf(a,'Input','Pointer','inputArg','const *')
addArgConf(a,'Output','Pointer','outputArg','none')
%% Attach the function control object to the model
attachToModel(a,gcs)
Alternatives
You can specify the argument configuration information in the
Model Interface dialog box. See Configuring Model Function Prototypes in the Real-Time Workshop Embedded Coder documentation.
See Also
 | addAdditionalSourcePath | | addCallback (cgv.CGV) |  |
Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
Get this Simulink Kit