How to configure set_param() per instance for arrays
Afficher commentaires plus anciens
I have a function 'deep' within a model that is called as an array. Each instance of this function needs a different value for its parameter. I already found that you can set the parameter with the set_param() command. This worked fine as long as I only had 1 instance in my array. But I need multiple. How can I set each instance its own value?
In more details. I have an array of 'DEV_DspBox' which receives its data from a PLC.

Setting a single value for the parameter works with this:
set_param('PlayGround_Model/DEV_DspBox[n]/DEV_DspBox/DEV_DspProbe_A/DEV_DspProbeSensorLeft/fbTriggerBuffer', 'nParNrOfDataRecords', "5");
But I need to be able to set the 'nParNrOfDataRecords' of the fbTriggerBuffer for each instance of DEV_DspBox separate. The value is depending on a distance of the sensor to a reference point. Each 'probe' is located within a different hardware position, so the buffer size is depending on the distance of the 'probe' to the reference point. Causing that the parameter needs to be different for each instance. How to do this?
Thanks for any suggestions in advance.
Cheers
Ludo
2 commentaires
madhan ravi
le 19 Déc 2023
Ludo could you please illustrate with an example? Since we don’t see the model complete , it’s hard to follow. When you mean single value, what do you mean? You want to make it a vector instead of a scalar? With your code you set nParNrOfDataRecords 5 but you want for example 5, 10? Is that right?
Ludo Houben
le 19 Déc 2023
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Naming Conventions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







