Main Content

isDefined

Class: coder.descriptor.TypedRegion
Namespace: coder.descriptor

Determine if data element is defined in generated code

Since R2025a

Syntax

tf = isDefined(implementation)

Description

tf = isDefined(implementation) returns 1 (true) if the data element is defined by the generated code. Otherwise, it returns 0 (false).

The data element is defined if all members of the TypedRegion object exist in the generated code.

Input Arguments

expand all

Description of implementation of data in the generated code, specified as a coder.descriptor.TypedRegion object.

Output Arguments

expand all

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

Data Types: logical

Examples

expand all

  1. Open the model.

    openExample('CustomCodeComments')
  2. Build the model.

    slbuild('CustomCodeComments')

  3. Create a coder.codedescriptor.CodeDescriptor object for the required model.

    codeDescObj = coder.getCodeDescriptor('CustomCodeComments')
    

  4. Return properties of the Inports data interface type in the generated code.

    dataInterfaces = getDataInterfaces(codeDescObj, 'Inports')
  5. Return properties of the code representation of the first Inport block.

    implementation = dataInterfaces(1).Implementation
  6. Return whether the data element is defined by its code representation.

    isDefined(implementation)

    ans =
      logical
       1

    Since isDefined returned logical 1, all members of implementation exist in the generated code.

Version History

Introduced in R2025a