Main Content

coder.dictionary.exist

Determine whether Embedded Coder Dictionary exists in model or data dictionary

Since R2020b

Description

tf = coder.dictionary.exist(sourceName) returns true if a model or Simulink® data dictionary sourceName contains an Embedded Coder Dictionary.

An Embedded Coder Dictionary is created when you open a model in the Embedded Coder app or when you open the Embedded Coder Dictionary dialog box for a model or a data dictionary.

example

Examples

collapse all

Create a Simulink data dictionary. Then, determine if the data dictionary contains an Embedded Coder Dictionary. Use the result to create an Embedded Coder Dictionary or to open the existing dictionary.

Create a Simulink data dictionary.

dataDictionary = Simulink.data.dictionary.create('DataDictionary.sldd');

Determine whether the data dictionary contains an Embedded Coder Dictionary. Open the existing Embedded Coder Dictionary or create and open an Embedded Coder Dictionary in the data dictionary.

if coder.dictionary.exist('DataDictionary.sldd')
    
    myCoderDict = coder.dictionary.open('DataDictionary.sldd');
          
else
             
    myCoderDict = coder.dictionary.create('DataDictionary.sldd');
          
end

Because the data dictionary did not contain an Embedded Coder Dictionary, the code creates a coder dictionary in the data dictionary.

Input Arguments

collapse all

Name of the model or Simulink data dictionary, specified as a character vector or string scalar.

Example: 'RollAxisAutopilot'

Output Arguments

collapse all

True or false result, returned as 1 or 0 of data type logical.

Version History

Introduced in R2020b