| Simulink® | ![]() |
Describe data structure used as value of signal or parameter
An object of this class describes a signal whose values are data structures (i.e., aggregates of data of different types as opposed to arrays of values of the same type). This class is intended to support development and use of custom blocks (e.g., S-Function blocks) that accept or output data structures. The class allows users of such blocks to determine the structure of the signals connected to them.
You can use either the Model Explorer or the MATLAB command line to create an instance of this class. You must create structure types in the MATLAB workspace. If you attempt to create a structure type in a model workspace, Simulink software displays an error.
To define the elements of a structure, create an array of instances of Simulink.StructElement at the MATLAB command line and assign the array as the value of the structure's Elements property. For example, the following commands define a structure that contains a floating point and an integer element.
v = Simulink.StructElement; v.Name = 'v'; v.DataType = 'single'; n = Simulink.StructElement; n.Name = 'n'; n.DataType = 'uint8'; s = Simulink.StructType; s.Elements = [v n];
You can use a structure type object to specify the data type of Inport and Signal Specification blocks. To do this, enter the name of the variable that references the structure type object as the data type in the block's parameter dialog box.
The Simulink S-function API lets you create S-functions capable of generating and manipulating signal structures (see the simstruc.h header file for more information). You can connect signal structures created by S-function blocks to any standard Simulink block that accepts any data type. This includes virtual blocks and the Switch block configured to require the same data type on all its data inputs.

Table that displays the properties of the structure's elements. You cannot edit this table. To add or delete this structure's elements or change the properties of elements, you must use MATLAB commands, e.g.,
state.Elements(1).DataType = 'double';
Name of a C header file that declares this structure. This field is intended for use by Real-Time Workshop software. Simulink software ignores it.
Description of this structure. This field is intended for you to use to document this structure. Simulink software itself does not use this field.
Name | Access | Description |
|---|---|---|
An array of Simulink.StructElement objects that define the names, data types, dimensions, and numeric types of the structure's elements. The elements must have unique names. (Struct elements) | ||
String that describes this structure. This property is intended for user use. Simulink software itself does not use it. (Description) | ||
String that specifies the name of a C header file that declares this structure. (Header file) |
![]() | Simulink.StructElement | Simulink.SubsysDataLogs | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |