partrepo.collection.applyDataSet
Syntax
Description
partrepo.collection.applyDataSet(
applies the part, blockName,collectionID,partID)partID, from the collection,
collectionID, to the block, blockName.
partrepo.collection.applyDataSet(
applies the specified table row, blockName,partsTable)partsTable, to the block.
Examples
This example shows how to apply a part from an installed collection to a Simscape block.
Install Collection
The MyResistors_1.0.0.mldatx file is a collection with three parts that parameterize the Resistor block in the Simscape foundation library. To install the collection, double-click the file or enter:
partrepo.collection.install("MyResistors_1.0.0.mldatx")Successfully installed part collection. Details:
Collection ID: MyOrg.MyResistors
Version: 1.0.0
Data set IDs:
MyManufacturer|R-0001|Resistor 1
MyManufacturer|R-0002|Resistor 2
MyManufacturer|R-0003|Resistor 3
Blocks with data sets from this collection:
fl_lib/Electrical/Electrical Elements/Resistor
To view information about the collection, use the partrepo.collection.listDataSets function. The collection ID is MyOrg.MyResistors.
partsTable = partrepo.collection.listDataSets("MyOrg.MyResistors")partsTable=3×2 table
CollectionId PartId
___________________ __________________________________
"MyOrg.MyResistors" "MyManufacturer|R-0001|Resistor 1"
"MyOrg.MyResistors" "MyManufacturer|R-0002|Resistor 2"
"MyOrg.MyResistors" "MyManufacturer|R-0003|Resistor 3"
Apply Part to Simscape Block
The MyResistorModel model contains three Simscape foundation library Resistor blocks in parallel. Open the model.
open("MyResistorModel")ans = logical
1
You can apply any of the parts to any of the Resistor blocks in the model. To apply the MyManufacturer|R-0001|Resistor 1 part to the block labeled Resistor 1, use the partrepo.collection.applyDataSet function.
partrepo.collection.applyDataSet("MyResistorModel/Resistor 1","MyOrg.MyResistors","MyManufacturer|R-0001|Resistor 1")
This example shows how to apply a part from an installed collection using a table entry.
Install a Collection
The MyResistors_1.0.0.mldatx file is a collection with three parts to parameterize the Resistor block in the Simscape foundation library. Install the collection.
partrepo.collection.install("MyResistors_1.0.0.mldatx",Overwrite=true)Successfully installed part collection. Details:
Collection ID: MyOrg.MyResistors
Version: 1.0.0
Data set IDs:
MyManufacturer|R-0001|Resistor 1
MyManufacturer|R-0002|Resistor 2
MyManufacturer|R-0003|Resistor 3
Blocks with data sets from this collection:
fl_lib/Electrical/Electrical Elements/Resistor
To view information about the collection, use the partrepo.collection.listDataSets function. The collection ID is MyOrg.MyResistors.
partsTable = partrepo.collection.listDataSets("MyOrg.MyResistors")partsTable=3×2 table
CollectionId PartId
___________________ __________________________________
"MyOrg.MyResistors" "MyManufacturer|R-0001|Resistor 1"
"MyOrg.MyResistors" "MyManufacturer|R-0002|Resistor 2"
"MyOrg.MyResistors" "MyManufacturer|R-0003|Resistor 3"
Apply a Part Using a Table Entry
The MyResistorModel model contains three Simscape foundation library Resistor blocks in parallel. Open the model.
open("MyResistorModel")ans = logical
1
You can apply any of the parts to any of the Resistor blocks in the model. To apply the MyManufacturer|R-0002|Resistor 2 part to the block labeled Resistor 2, specify its row in the partsTable table as an argument in the partrepo.collection.applyDataSet function.
R2_row = partsTable(2,:);
partrepo.collection.applyDataSet("MyResistorModel/Resistor 2",R2_row)Input Arguments
Simscape block to apply the part data set, specified as a string scalar, character vector, or block handle.
Collection ID for the part to apply, specified as a string scalar or character vector.
Part ID for the collection to apply, specified as a string scalar or character vector.
Table row that contains the collection ID and part ID of the part to apply as the first and second columns, respectively, specified as a table.
Version History
Introduced in R2026a
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)