setModelParameter

Configure model parameter for code generation

    Description

    example

    setModelParameter(myCodeMappingObj,modelParameter,Name,Value) configures the specified model parameter for code generation. Use this function to map the specified model parameter to the storage class and storage class property settings that the code generator uses to produce C code for the parameter or.

    Examples

    collapse all

    In the model code mappings for model myConfigModel, set the storage class for model parameter K1 to ExportedGlobal.

    cm = coder.mapping.api.get('myConfigModel');
    setModelParameter(cm,'K1','StorageClass','ExportedGlobal');
    

    In the model code mappings for model myConfigModel, set the storage class for model parameters throughout the model to Model default.

    cm = coder.mapping.api.get('myConfigModel');
    paramHandles = find(cm,'ModelParameters')
    setModelParameters(cm,paramHandles,'StorageClass','Model default');
    

    In the model code mappings for model myConfigModel, set the storage class for model parameters Table1 and Table2 to ExportedGlobal. Set the identifier for the variables representing the parameters in the generated code to mp_Table1 and mp_Table2.

    cm = coder.mapping.api.get('myConfigModel');
    setModelParameter(cm,'Table1','StorageClass','ExportedGlobal',...
       'Identifier','mp_Table1');
    setModelParameter(cm,'Table2','StorageClass','ExportedGlobal',...
       'Identifier','mp_Table2');
    

    Input Arguments

    collapse all

    Code mapping object (model code mappings) returned by a call to function coder.mapping.api.get.

    Example: myCM

    Name of the model workspace parameter to configure.

    Example: 'Table1'

    Data Types: char | string

    Name-Value Pair Arguments

    Example: 'StorageClass' 'ExportedGlobal'

    Specify comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments as Name1,Value1,…,NameN,ValueN. The order of the name and value pair arguments does not matter.

    Storage class to set for the specified model parameter. The name of a predefined storage class or storage class that is defined in the Embedded Coder Dictionary associated with the model. See Configure Parameters for C Code Generation.

    Name for the variable that represents the model parameter in the generated code.

    Data Types: char | string

    Introduced in R2020b
    Для просмотра документации необходимо авторизоваться на сайте