get_param fails with simscape block

조회 수: 1 (최근 30일)
Matthew Mishrikey
Matthew Mishrikey 2022년 2월 10일
댓글: Matthew Mishrikey 2022년 2월 10일
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.

채택된 답변

Walter Roberson
Walter Roberson 2022년 2월 10일
>> 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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating Custom Components and Libraries에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by