removeElement
Description
removeElement(
removes the data element with the name dataInterfaceObj
,elementName
)elementName
from the data
interface specified by dataInterfaceObj
.
Examples
Add, Get, and Remove Data Element from Data Interface
This example shows how to add, get, and remove data elements from a data interface.
Use the Simulink.dictionary.archdata.open
function to open an existing data
dictionary. This creates a Simulink.dictionary.ArchitecturalData
object,
archDataObj
.
archDataObj = Simulink.dictionary.archdata.open("myInterfaceDict.sldd")
archDataObj = ArchitecturalData with properties: DictionaryFileName: 'myInterfaceDict.sldd' Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface] DataTypes: [0×0 Simulink.dictionary.archdata.DataType] Constants: [0×0 Simulink.dictionary.archdata.Constant]
The data dictionary contains one data interface definition.
interfaceObj = getInterface(archDataObj,"DataInterface")
interfaceObj = DataInterface with properties: Name: 'DataInterface' Description: '' Elements: [0×0 Simulink.dictionary.archdata.DataElement] Owner: [1×1 Simulink.dictionary.ArchitecturalData]
Data interfaces are composed of data elements that describe parts of a data interface. This interface definition contains two data elements.
getElement(interfaceObj,"Element1")
ans = DataElement with properties: Name: 'Element1' Type: [1×1 Simulink.dictionary.archdata.ValueType] Description: '' Dimensions: '1' Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
getElement(interfaceObj,"Element2")
ans = DataElement with properties: Name: 'Element2' Type: [1×1 Simulink.dictionary.archdata.ValueType] Description: '' Dimensions: '1' Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Use the addElement
function
to add a new data element to the data interface.
dataElem1 = addElement(interfaceObj,"element3")
dataElem1 = DataElement with properties: Name: 'element3' Type: [1×1 Simulink.dictionary.archdata.ValueType] Description: '' Dimensions: '1' Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
You can get an existing data element using the getElement
function.
dataElem3 = getElement(interfaceObj,"element3")
dataElem3 = DataElement with properties: Name: 'element3' Type: [1×1 Simulink.dictionary.archdata.ValueType] Description: '' Dimensions: '1' Owner: [1×1 Simulink.dictionary.archdata.DataInterface]
Remove a data element from an interface using the removeElement
function.
removeElement(interfaceObj,"element3")
Input Arguments
dataInterfaceObj
— Data interface object
Simulink.dictionary.archdata.DataInterface
object
Data interface object containing the data element, specified as a Simulink.dictionary.archdata.DataInterface
object.
elementName
— Name of data element
character vector | string scalar
Name of the data element in the dataInterfaceObj
object, specified as a character vector or string scalar.
Version History
Introduced in R2023b
See Also
Tools
Objects
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de 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)