Skip to Main Content Skip to Search
Product Documentation

coder.EnumType class - Package: coder
Superclasses: coder.ArrayType

Represent set of MATLAB enumerations

Description

Specifies the set of MATLAB enumerations that the generated code should accept. Use with the fiaccel -args options.

Construction

enum_type = coder.typeof(enum_value) creates a coder.EnumType object representing a set of enumeration values of class (enum_value).

enum_type = coder.typeof(enum_value, sz, variable_dims) returns a modified copy of coder.typeof(enum_value) with (upper bound) size specified by sz and variable dimensions variable_dims. If sz specifies inf for a dimension, then the size of the dimension is unbounded and the dimension is variable size. When sz is [], the (upper bound) sizes of v do not change. If you do not specify variable_dims, all the dimensions of the type are fixed, except for those that are unbounded. When variable_dims is a scalar, it applies to all the dimensions, except if the dimension is 1 or 0, which are fixed, or if the dimension is unbounded, which is always variable size.

enum_type = coder.newtype(enum_name,sz,variable_dims) creates a coder.EnumType object that has variable size with (upper bound) sizes sz and variable dimensions variable_dims. If sz specifies inf for a dimension, then the size of the dimension is unbounded and the dimension is variable size. If you do not specify variable_dims, all the dimensions of the type are fixed, except for those that are unbounded. When variable_dims is a scalar, it applies to all the dimensions of the type, except if the dimension is 1 or 0, which is always fixed.

Input Arguments

enum_value

Enumeration value defined in a file on the MATLAB path.

sz

Size vector specifying each dimension of type object.

Default: [1 1] for coder.newtype

variable_dims

Logical vector that specifies whether each dimension is variable size (true) or fixed size (false).

Default: false(size(sz)) | sz==Inf for coder.newtype

enum_name

Name of a numeration defined in a file on the MATLAB path.

Properties

ClassName

Class of all values in the set.

SizeVector

The upper-bound size of arrays in the set.

VariableDims

A vector specifying whether each dimension of the array is fixed or variable size. If a vector element is true, the corresponding dimension is variable size.

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB Programming Fundamentals documentation.

Examples

Create a coder.EnumType object using a value from an existing MATLAB enumeration.

  1. Define an enumeration MyColors. On the MATLAB path, create a file named 'MyColors' containing:

    classdef(Enumeration) MyColors < int32
        enumeration
            green(1),
            red(2),
        end
    end
    
  2. Create a coder.EnumType object from this enumeration.

    t = coder.typeof(MyColors.red);

 

Create a coder.EnumType object using the name of an existing MATLAB enumeration.

  1. Define an enumeration MyColors. On the MATLAB path, create a file named 'MyColors' containing:

    classdef(Enumeration) MyColors < int32
        enumeration
            green(1),
            red(2),
        end
    end
    
  2. Create a coder.EnumType object from this enumeration.

    t = coder.newtype('MyColors');

See Also

coder.ArrayType | coder.newtype | coder.resize | coder.Type | coder.typeof | fiaccel

How To

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS