coder.dictionary.exist - Determine whether Embedded Coder Dictionary exists in model or data
dictionary - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/coder.dictionary.exist.html)) ([raw](?raw))
Main Content
Determine whether Embedded Coder Dictionary exists in model or data dictionary
Since R2020b
Syntax
Description
[tf](#mw%5F23c4dfa4-75fd-45f2-85e7-8c2baff5bb69) = coder.dictionary.exist([sourceName](#mw%5Fc2ce3f29-79e6-4c81-85f6-13c9a24c4112))
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.
Examples
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
Name of the model or Simulink data dictionary, specified as a character vector or string scalar.
Example: 'RollAxisAutopilot'
Output Arguments
True or false result, returned as 1
or 0
of data type logical
.
Version History
Introduced in R2020b