get_param fails with simscape block
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matthew Mishrikey
le 10 Fév 2022
Commenté : Matthew Mishrikey
le 10 Fév 2022
Weird/unexpected behavior, not sure if it's a bug.
I'm trying to use get_param to access a stock simscape thermal component. If I do this using gcb, no problem. If I do it with bdroot, i don't get an answer.
>> get_param(gcb,'ClassName')
ans =
'cauer_model_element'
>> get_param(gcb,'resistance')
ans =
'3'
>> get_param(strcat(bdroot,'/Heat Sink/Sink'),'resistance');
>>
>> get_param(strcat(bdroot,'/Heat Sink/Sink'),'blahblah');
Cauer Thermal Model
Element block (mask) does not have a parameter named 'blahblah'
The last case where I try blahblah parameter is just to prove the path is correct. I also tried to retrieve 'ObjectParameters' - no answer.
I did a test to see if it had to do with being inside a subsystem (or if the space in the subsystem's name was an issue), but even a simscape component at the top level behaves the same way.
You can recreate this by making a new blank model, and plunking down any simscape component, and trying to access it's parameters from the base workspace command line.
0 commentaires
Réponse acceptée
Walter Roberson
le 10 Fév 2022
>> get_param(strcat(bdroot,'/Heat Sink/Sink'),'resistance');
You put a semi-colon at the end of the line, and that means "execute the line but do not print the result" . Notice your first (successful) get_param did not have the semicolon
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating Custom Components and Libraries dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!