Main Content

simulink.compiler.getTunableVariables

Find names of all tunable variables

Since R2021a

    Description

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

    Each leaf of a struct variable present in the model is given an entry in the output of simulink.compiler.getTunableVariables function.

    To ensure that the function simulink.compiler.getTunableVariables the .slxc file is not present in the same folder as the model.

    Examples

    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.

    open_system('sldemo_suspn_3dof')

    Find the tunable variables present in the model.

    simulink.compiler.getTunableVariables('sldemo_suspn_3dof')
    ### 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×8 struct array with fields:
    
        QualifiedName
        Value

    View a variable and its value.

    ans(1)
    ans = 
    
      struct with fields:
    
        QualifiedName: "Ixx"
                Value: 1500

    Input Arguments

    collapse all

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

    Version History

    Introduced in R2021a