Main Content

valid

Class: coder.dictionary.Entry
Package: coder.dictionary

Determine if coder.dictionary.Entry object represents a valid code definition

Syntax

tf = valid(entryObj)

Description

tf = valid(entryObj) returns true if the coder.dictionary.Entry object entryObj is valid. A coder.dictionary.Entry object is valid if it represents an existing code definition. When you remove the code definition that the entry represents, the coder.dictionary.Entry object is not valid.

Input Arguments

expand all

Embedded Coder Dictionary entry, specified as a coder.dictionary.Entry object.

Output Arguments

expand all

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

Examples

expand all

Open the model rtwdemo_roll and represent the Embedded Coder Dictionary by using a coder.Dictionary object. Use this object to access the Storage Classes section of the dictionary and represent the section by using a coder.dictionary.Section object.

rtwdemo_roll
coderDictionary = coder.dictionary.open('rtwdemo_roll');
storageClassesSect = getSection(coderDictionary, 'StorageClasses');

Represent the example storage class ParamStruct by using a coder.dictionary.Entry object.

entryObj = getEntry(storageClassesSect,'ParamStruct');

Check if the coder.dictionary.Entry object in the base workspace represents a valid code definition.

valid(entryObj)
ans =

  logical

   1

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

deleteEntry(storageClassesSect,'ParamStruct');
valid(entryObj)
ans =

  logical

   0
Introduced in R2019b