| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
You can use the function prototype control functions (listed in Function Prototype Control Functions), to programmatically control model function prototypes. Typical uses of these functions include:
Create and validate a new function prototype
Create a model-specific C function prototype with obj = RTW.ModelSpecificCPrototype, where obj returns a handle to a newly created, empty function prototype.
Add argument configuration information for your model ports using RTW.ModelSpecificCPrototype.addArgConf.
Attach the function prototype to your loaded ERT-based Simulink model using RTW.ModelSpecificCPrototype.attachToModel.
Validate the function prototype using RTW.ModelSpecificCPrototype.runValidation.
If validation succeeds, save your model and then generate code using the rtwbuild function.
Modify and validate an existing function prototype
Get the handle to an existing model-specific C function prototype that is attached to your loaded ERT-based Simulink model with obj = RTW.getFunctionSpecification(modelName), where modelName is a string specifying the name of a loaded ERT-based Simulink model, and obj returns a handle to a function prototype attached to the specified model.
You can use other function prototype control functions on the returned handle only if the test isa(obj,'RTW.ModelSpecificCPrototype') returns 1. If the model does not have a function prototype configuration, the function returns []. If the function returns a handle to an object of type RTW.FcnDefault, you cannot modify the existing function prototype.
Use the Get and Set functions listed in Function Prototype Control Functions to test and reset such items as the function names, argument names, argument positions, argument categories, and argument type qualifiers.
Validate the function prototype using RTW.ModelSpecificCPrototype.runValidation.
If validation succeeds, save your model and then generate code using the rtwbuild function.
Create and validate a new function prototype, starting with default configuration information from your Simulink model
Create a model-specific C function prototype using obj = RTW.ModelSpecificCPrototype, where obj returns a handle to a newly created, empty function prototype.
Attach the function prototype to your loaded ERT-based Simulink model using RTW.ModelSpecificCPrototype.attachToModel.
Get default configuration information from your model using RTW.ModelSpecificCPrototype.getDefaultConf.
Use the Get and Set functions listed in Function Prototype Control Functions to test and reset such items as the function names, argument names, argument positions, argument categories, and argument type qualifiers.
Validate the function prototype using RTW.ModelSpecificCPrototype.runValidation.
If validation succeeds, save your model and then generate code using the rtwbuild function.
Note You should not use the same model-specific C function prototype object across multiple models. If you do, changes that you make to the step and initialization function prototypes in one model are propagated to other models, which is usually not desirable. |
Function Prototype Control Functions
| Function | Description |
|---|---|
| RTW.ModelSpecificCPrototype.addArgConf | Add step function argument configuration information for Simulink model port to model-specific C function prototype |
| RTW.ModelSpecificCPrototype.attachToModel | Attach model-specific C function prototype to loaded ERT-based Simulink model |
| RTW.ModelSpecificCPrototype.getArgCategory | Get step function argument category for Simulink model port from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getArgName | Get step function argument name for Simulink model port from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getArgPosition | Get step function argument position for Simulink model port from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getArgQualifier | Get step function argument type qualifier for Simulink model port from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getDefaultConf | Get default configuration information for model-specific C function prototype from Simulink model to which it is attached |
| RTW.ModelSpecificCPrototype.getFunctionName | Get function names from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getNumArgs | Get number of step function arguments from model-specific C function prototype |
| RTW.ModelSpecificCPrototype.getPreview | Get model-specific C function prototype code previews |
| RTW.configSubsystemBuild | Launch GUI to configure C function prototype or C++ encapsulation interface for right-click build of specified subsystem |
| RTW.getFunctionSpecification | Get handle to model-specific C function prototype object |
| RTW.ModelSpecificCPrototype.runValidation | Validate model-specific C function prototype against Simulink model to which it is attached |
| RTW.ModelSpecificCPrototype.setArgCategory | Set step function argument category for Simulink model port in model-specific C function prototype |
| RTW.ModelSpecificCPrototype.setArgName | Set step function argument name for Simulink model port in model-specific C function prototype |
| RTW.ModelSpecificCPrototype.setArgPosition | Set step function argument position for Simulink model port in model-specific C function prototype |
| RTW.ModelSpecificCPrototype.setArgQualifier | Set step function argument type qualifier for Simulink model port in model-specific C function prototype |
| RTW.ModelSpecificCPrototype.setFunctionName | Set function names in model-specific C function prototype |
![]() | Model Function Prototypes Example | Sample M-Script for Configuring Model Function Prototypes | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |