Access variable names for Simscape block through code

조회 수: 2 (최근 30일)
Federico Toso
Federico Toso 2023년 8월 4일
댓글: Federico Toso 2023년 8월 30일
I would like to access the name of the variables of a generic Simscape block which is used in my model.
The function "get_param" works for block parameters, but not for block variables.
For example: suppose I have a Resistor block in my model; I am looking for a Matlab function which tells me that there exists a variable called "i", associated to this block

답변 (1개)

Rohit Kulkarni
Rohit Kulkarni 2023년 8월 23일
Hi,
In my understanding you want to access the variable names from a simscape model
you can use the following function
[names,values,units] = symReadSSCVariables(componentName)
It returns cell arrays containing the names, values, and units of all variables from the Simscape™ component called componentName.
Refer to the documentation for details.
Thanks
  댓글 수: 2
Federico Toso
Federico Toso 2023년 8월 23일
Exactly what I was looking for
Thank you
Federico Toso
Federico Toso 2023년 8월 30일
EDIT
It seems like the function symReadSSCVariables requires "Symbolic Math Toolbox". Is there a similar function which is available even if no additional Toolbox is installed? (i.e. only Simulink and Simscape required)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Troubleshooting에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by