Types Editor - Create custom data types - MATLAB (original) (raw)
Create custom data types
Since R2024a
Description
The Types Editor allows you to define custom data types. You can then use the types created in the Types Editor to define data types of tokens that flow through pins of an action node.
The kinds of data types that you can define in the Types Editor include:
- Composite Type — A composite type is equivalent to a bus that contains fields of different values and data types.
- Value Type — A value type is a data type assigned to a single field value.
Open the Types Editor
- Create an activity diagram.
- In the Activity Diagram toolstrip, in the Modeling tab, selectTypes Editor.
Parameters
Add a new composite data type by clicking or select one of these options from the drop-down list.
- Composite Type — A composite type is equivalent to a bus that contains fields of different values and data types.
- Value Type — A value type is a data type assigned to a single field value.
Add a new bus element to the selected composite type by clicking .
Delete the selected type or element.
Import interfaces from these locations:
- Base Workspace
- MAT-file
Save types in the current data dictionary or attach an existing data dictionary to your model. Select a specific option from the list:
- Save dictionary
- Save to new dictionary
- Link existing dictionary
Choose a profile XML file to import into the currently selected data dictionary. You can also remove an existing profile from the selected data dictionary.
Show and hide columns on the Types Editor by checking the corresponding boxes:
- Type
- Dimensions
- Units
- Complexity
- Minimum
- Maximum
- Description
Choose a view for the Types Editor to display interfaces:
- Dictionary View — Show types used across the model that can be reused for multiple tokens.
- Pin View — Show types held by the selected input or output pin of an action node.
More About
An activity diagram describes system behavior that models the flow of tokens from inputs to outputs through a controlled sequence of actions. An activity diagram contains action nodes with pins connected by flow lines.
Use activity diagrams to conceptualize a system, visualize functional flow through actions or decisions, and understand how system components interact with one another.
Tokens are objects that flow in the activity diagram. A token can represent data such as structures and integers, or a token can simply pass on the control.
These are the types of tokens:
- Object token — Represents an object, such as a piece of data
- Control token — Represents a control or a triggering event that does not carry any data
An action node is a key building block in an activity diagram. An action node represents an action to be executed. Action nodes consume input tokens and produce output tokens on pins.
Use a MATLAB® function or a nested activity diagram to describe the behavior of an action node.
A control node routes a logical flow of tokens through the system.
Use control nodes and flows to route tokens. Control nodes can be used to initialize, split, merge, and terminate token flows.
A pin acts as a buffer for object tokens and directs tokens into or out of an action node. The directionality of the pin represents input or output. You can connect pins by object flows.
Use pins to route an object token to or from an Action Node. Pins are also used to store object tokens before or during execution. You can use pins only for object flows.
A parameter node route tokens into or out of a nested activity diagram. When a pin is created, a corresponding parameter node will be created inside the nested activity.
Use parameter node to define how tokens enter or leave a nested activity. There are two types of parameter nodes input and output.
A flow in an activity diagram connects two nodes. A dashed line represents a control flow. A solid line represents an object flow.
These are the types of flows:
- Object flow — Tokens in an object flow contains token data on which actions operate. You can use object flows to route input or output tokens to carry information or physical items between object nodes.
- Control flow — Tokens in a control flow trigger the execution of actions. You can use control flows to model transfer of control from one Action Node to another.
A type defines the contents of a token that flows through a pin. A type has dimension, unit, complexity, minimum, maximum and description.
These are three token types in activity diagrams:
- Value type: A value type is a type assigned to a single value.
- Composite type: A composite type is equivalent to a bus structure that contains field of different values and data types.
- MATLAB class type: A MATLAB class type references a MATLAB class on the path that defines a complex object with properties and methods. You can use a built-in MATLAB class or define your own MATLAB class. For more information on using MATLAB class type, see Model Complex Objects in Activity Diagrams Using MATLAB Class Tokens.
Version History
Introduced in R2024a
See Also
Functions
Tools
Blocks
- Initial Node | Action Node | Pin | Parameter Node | Decision or Merge Node | Join or Fork Node | Flow Final Node | Activity Final Node