simulink: assign values to a resistance by using matlab scripts

6 Ansichten (letzte 30 Tage)
AAAA
AAAA am 6 Mai 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?

Antworten (1)

Andreas Goser
Andreas Goser am 7 Mai 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 Kommentar
TAB
TAB am 7 Mai 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by