Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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?

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 9 de Dic. de 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

Categorías

Más información sobre Programmatic Model Editing 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