simulink: assign values to a resistance by using matlab scripts

6 views (last 30 days)
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?

Answers (1)

Andreas Goser
Andreas Goser on 7 May 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 Comment
TAB
TAB on 7 May 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.

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!