convertToStructType
Description
converts the data interface object StructTypeObj
= convertToStructType(dataInterfaceObj
)interfaceObj
to a Simulink.dictionary.archdata.StructType
object.
Examples
Convert Data Interface to Struct Type
To convert a data interface to a struct type in a data dictionary,
use the convertToStructType
function.
In this example, the dictionary MyInterfaces.sldd
contains one
data interface.
archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd")
archDataObj = ArchitecturalData with properties: DictionaryFileName: 'MyInterfaces.sldd' Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface] DataTypes: [0×0 Simulink.dictionary.archdata.DataType] Constants: [0×0 Simulink.dictionary.archdata.Constant]
The data interface contains two data elements.
dataInterfaceObj = getInterface(archDataObj,"DataInterface1")
interfaceObj = DataInterface with properties: Name: 'DataInterface1' Description: '' Elements: [1×2 Simulink.dictionary.archdata.DataElement] Owner: [1×1 Simulink.dictionary.ArchitecturalData]
To convert the data interface to a struct type, use the
convertToStructType
function.
structTypeObj = convertToStructType(dataInterfaceObj)
structTypeObj = StructType with properties: Name: 'DataInterface1' Description: '' Elements: [1×2 Simulink.dictionary.archdata.StructElement] Owner: [1×1 Simulink.dictionary.ArchitecturalData]
The output struct type contains two struct elements corresponding to the two data elements of the input data interface.
The architectural data object now contains no data interfaces, and one struct type.
archDataObj
archDataObj = ArchitecturalData with properties: DictionaryFileName: 'MyInterfaces.sldd' Interfaces: [0×0 Simulink.dictionary.archdata.DataInterface] DataTypes: [1×1 Simulink.dictionary.archdata.StructType] Constants: [0×0 Simulink.dictionary.archdata.Constant]
Input Arguments
dataInterfaceObj
— Data interface object
Simulink.dictionary.archdata.DataInterface
object
Data interface object, specified as a Simulink.dictionary.archdata.DataInterface
object.
Output Arguments
StructTypeObj
— Struct type object
Simulink.dictionary.archdata.StructType
object
Struct type object, returned as a Simulink.dictionary.archdata.StructType
object. The structure type object
contains StructElement
objects that are equivalent to the
DataElement
objects contained in the input data interface object,
dataInterfaceObj
.
Version History
Introduced in R2023b
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)