simulink: assign values to a resistance by using matlab scripts
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
Réponses (1)
Andreas Goser
le 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');
1 commentaire
TAB
le 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.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!