Main Content

getDataDefault

R2026b

Get default code settings for data category

    Description

    value = getDataDefault(myCoderDictionaryObj, category, property) returns the value from the code mappings of the specified property for the specified data category.

    example

    Examples

    collapse all

    View and modify data defaults of an Embedded Coder® dictionary configured with data interface configuration.

    Use the function Simulink.data.dictionary.create to create the dictionary file dataDict.sldd and the associated Simulink.data.Dictionary object. Then use the function coder.dictionary.create to create the data interface Embedded Coder dictionary object, and store handles to the objects in variables.

    dictFile = "dataDict.sldd";
    simDictObj = Simulink.data.dictionary.create(dictFile);
    ecoderDataDictObj = coder.dictionary.create(dictFile,"DataInterface");

    Use the function coder.mapping.api.get() with the dictionary file name to get a handle to the mapping object of the dictionary mapping object and store it in the variable dictMapObj.

    dictMapObj = coder.mapping.api.get(dictFile);

    Use the function setDataDefault to set the default dictionary value for the storage class of outports, then use the function getDataDefault to verify that the default has been updated.

    setDataDefault(dictMapObj,"Outports",StorageClass="ExportedGlobal")
    getDataDefault(dictMapObj,"Outports","StorageClass")
    ans = 'ExportedGlobal'

    Input Arguments

    collapse all

    Coder dictionary object returned by a call to function coder.mapping.api.get.

    Category of data elements to return a property value for.

    Example: 'Inports'

    Code mapping property that you return a value for. Specify one of these property names or a property name for a storage class defined in the Embedded Coder Dictionary .

    Information to ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for data element in the generated codeIdentifier
    Name of source definition file that contains definitions for global data that is read by the data element and external codeDefinitionFile
    Name of get function called by code generated for the data elementGetFunction
    Name of source header file that contains declarations for global data that is read by the model data element and external codeHeaderFile
    Character vector or string scalar that names a memory section for a model defined in the Embedded Coder Dictionary.MemorySection
    Name of model for which the code generator places the definition for data element shared by multiple models in a model hierarchy Owner
    Boolean value indicating whether code generator preserves dimensions of data that is represented as a multidimensional arrayPerserveDimensions
    Name of set function called by code generated for data elementSetFunction
    Name of structure in generated code for data elementStructName

    Example: 'Identifier'

    Output Arguments

    collapse all

    The code mapping property value of the specified category, returned as a character vector.

    Version History

    Introduced in R2021a