Azzera filtri
Azzera filtri

get_param fails with simscape block

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 10 Feb 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

Più risposte (0)

Categorie

Scopri di più su Troubleshooting in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by