Main Content

Custom MATLAB file

Update active configuration parameters of parent model by using file containing custom MATLAB code

  • Custom MATLAB file block

Embedded Coder / Configuration Wizards


When you add a Custom MATLAB file block to your Simulink® model and double-click it, a custom MATLAB® script executes and configures model parameters that are relevant to code generation. Set a block parameter to invoke the build process after configuring the model.

After you double-click the block, open the Configuration Parameters dialog box to see that the model parameter values have changed.

Use the example MATLAB script, matlabroot/toolbox/coder/simulinkcoder_core/rtwsampleconfig.m with the Custom MATLAB file block. Adapt the script to your model requirements. The block and the script provide a starting point for customization. For more information, see Create a Custom Configuration Wizard Block.


To provide a quick way to switch between configurations, you can include more than one Configuration Wizard block in your model.


expand all

Objective for updating the active configuration parameters of a parent model by using a predefined MATLAB script.

Predefined or custom MATLAB script that updates the active configuration parameters of the parent model.


This parameter is only used with this Configuration Wizards block. To enable this parameter, set Configure the model for to Custom.

If selected, the predefined script initiates the code generation and build process after updating the configuration parameters.

Version History

Introduced in R2011a