Main Content

entityType

Class: matlab.DiscreteEventSystem
Namespace: matlab

Define entity type

Syntax

entitytype=entityType(name)
entitytype=entityType(name,datatype)
entitytype=entityType(name,datatype,dimensions)
entitytype=entityType(name,datatype,dimensions,complexity)

Description

entitytype=entityType(name) defines a named entity type.

entitytype=entityType(name,datatype) defines a named entity type that takes real values and with specified data type of size 1.

entitytype=entityType(name,datatype,dimensions) defines a named entity type that takes real values and with specified data type and size.

entitytype=entityType(name,datatype,dimensions,complexity) defines a named entity type with a specified data type, dimensions, and complexity.

Input Arguments

expand all

Entity type name.

Data type that specifies the data type of the entity. The data type must be a built-in data type or a bus object.

Dimensions, specified as a vector of doubles, specifying the dimensions of the entity.

Complexity, specified as a logical or double value, specifying the complexity of the entity:

  • false or 0 — If the entity contains real values.

  • true or any positive number — If the entity contains complex values.

Output Arguments

expand all

Entity type, specified as a MATLAB structure.

Examples

expand all

Define entity types type1, type2, and type3.

function entityTypes = getEntityTypesImpl(obj)
    % Define entity type 'type1' with inherited data type, dimension
    % and complexity
    t1 = obj.entityType('type1');
 
    % Define entity type 'type2' with specified data type ('mybus'),
    % default dimension and complexity (i.e. scalar real values)
    t2 = obj.entityType('type2', 'mybus');
 
    % Define entity type 'type3' with specified data type ('double'),
    % dimension (2 by 3 matrix), and complexity (complex)
    t3 = obj.entityType('type3', 'double', [2 3], true);
 
    entityTypes = [t1, t2, t3];
end

Version History

Introduced in R2016a