removeField
Description
removes the field, Metadata
= removeField(Metadata
,fieldNames
)fieldNames
, from the block data set
Metadata
object, Metadata
.
Examples
This example shows how to create a BlockDataSet
object from a block and remove a metadata field.
Create a model that contains a Simscape block. This example uses a Capacitor block from the Foundation Library.
modelName = "myModel"; close_system(modelName,0) libraryBlockName = "fl_lib/Electrical/Electrical Elements/Capacitor"; open_system(new_system(modelName)); blockName = add_block(libraryBlockName,modelName + "/" + "Example block");
Create a block data set from the Capacitor block and display the metadata.
myDataSet = partrepo.simscape.dataSetFromBlock(blockName); disp(myDataSet.Metadata)
Metadata (Incomplete) with properties: Manufacturer: "" PartNumber: "" BlockType: "SimscapeBlock" ParameterizationDate: "19-Nov-2024" SimulinkRelease: "25.1" ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor" LibraryVersion: "25001000.1" ModelingEntityId: "foundation.electrical.elements.capacitor" ModelingEntityType: "SimscapeComponent" CustomIdentifier: "" PartSchemaId: "defaultSimscapeSchema"
Add RatedPower
and PartSeries
metadata
properties, then display the updated
metadata.
myDataSet.Metadata.RatedPower = simscape.Value(3,"W") myDataSet.Metadata.PartSeries ="c1" disp(myDataSet.Metadata)
myDataSet = BlockDataSet with properties: ID: "||" (format) Metadata: [1×1 Metadata] (13 entries, Incomplete) Parameters: [1×1 Parameters] (3 entries) Metadata (Incomplete) with properties: Manufacturer: "" PartNumber: "" BlockType: "SimscapeBlock" ParameterizationDate: "22-Jan-2025" SimulinkRelease: "25.1" ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor" LibraryVersion: "25001000.1" ModelingEntityId: "foundation.electrical.elements.capacitor" ModelingEntityType: "SimscapeComponent" CustomIdentifier: "" PartSchemaId: "defaultSimscapeSchema" RatedPower: 3 (W) PartSeries: "c1"
Remove the PartSeries
property and display the updated
metadata.
myDataSet.Metadata = myDataSet.Metadata.removeField("PartSeries")
disp(myDataSet.Metadata)
Metadata (Incomplete) with properties: Manufacturer: "" PartNumber: "" BlockType: "SimscapeBlock" ParameterizationDate: "22-Jan-2025" SimulinkRelease: "25.1" ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor" LibraryVersion: "25001000.1" ModelingEntityId: "foundation.electrical.elements.capacitor" ModelingEntityType: "SimscapeComponent" CustomIdentifier: "" PartSchemaId: "defaultSimscapeSchema" RatedPower: 3 (W)
Input Arguments
Metadata of a block data set, specified as a
partrepo.simscape.Metadata
object.
Names of the field to remove, specified as a character vector or string scalar that contains the property name.
Data Types: char
| string
Output Arguments
Updated Simscape block data set metadata, returned as a
partrepo.simscape.Metadata
object.
Version History
Introduced in R2025a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)