Effacer les filtres
Effacer les filtres

How to add multiple "display" block to multiple subsystems in a simulink file programmatically

6 vues (au cours des 30 derniers jours)
Problem statement: I have 500 of subsystem in a simulation file. I need to add display block in simulink to all subsystems. Manually doing it is taking lot of time. Is there is any method is there to script it automatically?
I have tried with following code, it is working correctly with one subssytem
"add_block('simulink/Sinks/Display','simulation path of one subsystem')
add_line('simulation path of one subsystem','Display/1','autorouting','on')
But if I use same code for all subsystems means once again declaring path of all subsystems is time consuming. Is there is any other ways is there?

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 9 Déc 2023
Yes you can do it programmingly. see help for find_system() and do something like this:
AllSys=find_system(ModelName, 'SearchDepth',1,'BlockType','Subsystem')
for k=1:numel(AllSys)
add_block(...)
end

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by