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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)