Main Content

Store Parameter Constraints in MATLAB Code Files

You can use the Parameter Table to manage constraints on your model parameters for analysis. If you place a constraint on a parameter in your model, during analysis that parameter takes only your specified constraint value or values. A group of constraints on parameters in the same model is also called a parameter configuration. You can store groups of parameter constraints in a MATLAB® code file called a parameter configuration file. For more information on configuring parameters for Simulink® Design Verifier™, see Define Constraint Values for Parameters.

To enable parameter configuration, on the Design Verifier tab, in the Prepare section, from the drop-down menu for the mode settings, click Settings. In the Configuration Parameters dialog box, on the Design Verifier > Parameters pane, select Enable parameter configuration.

Export Parameter Constraints to File

Using the Parameter Table, you can export parameter constraint values to a MATLAB code file. If you later want to use the same parameter configuration in a different analysis, you can import your previously specified parameter constraint values from the MATLAB code file.

To export parameter constraint values to a file:

  1. On the Design Verifier tab, in the Prepare section, from the drop-down menu for the mode settings, click Settings. In the Configuration Parameters dialog box, select Design Verifier > Parameters.

    The Parameter Table shows specified constraint values for parameters in your model, as in the following example screen shot.

  2. Click Export to File.

    The Parameter Configuration File saves the current parameter configurations to a .m file with the name you specify. Parameters that do not have the Use check box enabled appear as commented lines in the parameter configuration file.

    In the example shown in the previous step, the parameter configuration file contains the following code:

    function params = ex_many_params_config
    params.param_01 = {0, 1};
    % params.param_02 = {0, 01};
    params.param_03 = {0, 1};
    % params.param_04 = {0, 1};

Import Parameter Constraints from File

If you defined parameter configurations for analysis in a release prior to R2014a, you can import corresponding MATLAB files and manage these parameters in the Parameter Table.

To import parameter constraints from a MATLAB code file:

  1. On the Design Verifier tab, in the Prepare section, from the drop-down menu for the mode settings, click Settings. In the Configuration Parameters dialog box, select Design Verifier > Parameters.

  2. Click Add from File. Choose a parameter configuration file.

    The Parameter Table loads specified parameter constraints from the code, excluding code comments, from the file. If you specify a constraint for a parameter and then load a parameter configuration file containing constraint specification for the same parameter, the constraint specified in the file overwrites the preexisting constraint in the table.

Simulink Design Verifier provides an example parameter configuration file for the example model sldvdemo_param_identification:

matlabroot/toolbox/sldv/sldvdemos/sldvdemo_param_ident_config.m

Related Topics