Borrar filtros
Borrar filtros

Access variable names for Simscape block through code

3 visualizaciones (últimos 30 días)
Federico Toso
Federico Toso el 4 de Ag. de 2023
Comentada: Federico Toso el 30 de Ag. de 2023
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

Respuestas (1)

Rohit Kulkarni
Rohit Kulkarni el 23 de Ag. de 2023
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 comentarios
Federico Toso
Federico Toso el 23 de Ag. de 2023
Exactly what I was looking for
Thank you
Federico Toso
Federico Toso el 30 de Ag. de 2023
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)

Iniciar sesión para comentar.

Categorías

Más información sobre Variable Initialization en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by