Main Content


Find names of all tunable variables

Since R2021a


    simulink.compiler.getTunableVariables(modelName) returns a structure containing all the tunable variables in the model modelName, and their values.

    Each tunable leaf of a struct variable present in the model is given an entry in the output of simulink.compiler.getTunableVariables function. A leaf of a struct variable is tunable only when it is not used in any non-tunable expressions.


    collapse all

    This example uses the model sldemo_suspn_3dof and shows how to use simulink.compiler.getTunableVariables to find the tunable variables in a model.

    Open the model.


    Find the tunable variables present in the model.

    ### Building the rapid accelerator target for model: sldemo_suspn_3dof
    ### Successfully built the rapid accelerator target for model: sldemo_suspn_3dof
    Build Summary
    Top model rapid accelerator targets built:
    Model              Action                       Rebuild Reason                                    
    sldemo_suspn_3dof  Code generated and compiled  Code generation information file does not exist.  
    1 of 1 models built (0 models already up to date)
    Build duration: 0h 1m 1.066s
    ans = 
      1×9 struct array with fields:

    The output of the simulink.compiler.getTunableVariables function is a struct with QualifiedName, Workspace, and Value field. Each tunable variable has a separate entry in the output struct. View a variable and its value.

    ans = 
      struct with fields:
        QualifiedName: "Kr"
            Workspace: 'global-workspace'
                Value: 21000

    Input Arguments

    collapse all

    Name of model for which you want to find tunable parameters, specified as a string.

    Version History

    Introduced in R2021a