| Simulink Reference | ![]() |
Describe a data structure used as the value of a signal or parameter
Description
An object of this class describes a signal or parameter 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. 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 simstruct.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.
Property Dialog Box
Properties
| Name |
Access |
Description |
Elements |
RW |
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) |
Description |
RW |
String that describes this structure. This property is intended for user use. Simulink itself does not use it. (Description) |
HeaderFile |
RW |
String that specifies the name of a C header file that declares this structure. (Header file) |
See Also
Simulink.StructElement
| Simulink.StructElement | Simulink.SubsysDataLogs | ![]() |
© 1994-2005 The MathWorks, Inc.