simulink: assign values to a resistance by using matlab scripts

6 visualizaciones (últimos 30 días)
AAAA
AAAA el 6 de Mayo de 2012
Dear all
There is a block in my circuit called R1 and its value needs to change everytime when I run the simulation. I would like to write an matlab script that does this automatically. I would like to store all the values of R1 in an arrey and everytime when I run my simulink simulation, one value of R1 is assigned to the corresponding block in my circuit. Does anyone know how this can be achieved?

Respuestas (1)

Andreas Goser
Andreas Goser el 7 de Mayo de 2012
Correctly to the comment above, the command to make this is SET_PARAM and certainly it is always in the documentation.
However, many users find it difficult to find the exact parameter they need to change. Two tips here.
get_param(gcb, 'ObjectParameters');
This return all existing parameters. Try
set_param(gcb, 'Name', 'Myblockname');
to familiarize with the syntax. Andreas there is also a list of all parameters here in the manual.
  1 comentario
TAB
TAB el 7 de Mayo de 2012
Alternatively, use "get(gcbh)" to list all the parameters with their values in command window.
The resistor block R1 mentioned by AAAA is from some specific toolbox (may be from SimElectronics) and it is not included in above list.

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by