Main Content

valid

Class: coder.Dictionary
Namespace: coder

Determine whether coder.Dictionary object represents a valid Embedded Coder Dictionary

Syntax

tf = valid(coderDictionaryObj)

Description

tf = valid(coderDictionaryObj) returns true if the coder.Dictionary object coderDictionaryObj is valid. A coder.Dictionary object is valid if it represents an existing Embedded Coder Dictionary. When you remove the Embedded Coder Dictionary, the coder.Dictionary object is not valid.

Input Arguments

expand all

Embedded Coder Dictionary, specified as a coder.Dictionary object.

Output Arguments

expand all

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

Examples

expand all

Create a data dictionary named 'dataDict.sldd' in the base workspace and create an Embedded Coder Dictionary in the data dictionary. Represent the Embedded Coder Dictionary by using the coder.Dictionary object myCoderDictObj in the base workspace.

Simulink.data.dictionary.create('dataDict.sldd');
myCoderDictObj = coder.dictionary.create('dataDict.sldd');

Check whether the coder.Dictionary object in the base workspace represents a valid Embedded Coder Dictionary.

valid(myCoderDictObj)
ans =

  logical

   1

Remove the Embedded Coder Dictionary from the data dictionary and check the coder.Dictionary object again. When you remove the Embedded Coder Dictionary, the coder.Dictionary object is not valid.

coder.dictionary.remove('dataDict.sldd');
valid(myCoderDictObj)
ans =

  logical

   0

Version History

Introduced in R2019b