Find Triggered subsystem in a simulink model

12 visualizaciones (últimos 30 días)
Sunu
Sunu el 4 de Nov. de 2013
Respondida: Jonathan LeSage el 4 de Nov. de 2013
Is there a command in matlab to find Subsystems that have trigger port. I want to replace a different timing raster for all the triggered subsystem.

Respuesta aceptada

Jonathan LeSage
Jonathan LeSage el 4 de Nov. de 2013
One potential method would be to generate a list of all the blocks in your Simulink model, and then find blocks which are of the type 'TriggerPort'. From there, you just need to determine the parent block of the 'TriggerPort' which gives you the Triggered Subsystems that you are looking for. You can accomplish all of these operations programmatically via the get_param and find_system functions.
Here is a quick little example script that performs the operations that I described above. The find and strcmp functions are used to determine which blocks are of the type 'TriggerPort' from the blockTypes cell list.
% Generate a cell list of all blocks in the current Simulink model
blockList = find_system(bdroot,'Type','block');
% Generate a list of the block types
blockTypes = get_param(blockList,'BlockType');
% Find all blocks with trigger ports (enabled subsystems)
indexTrigger = find(strcmp(blockTypes,'TriggerPort'));
% Interate through all found triggers and determine "parent" subsystem
for i = 1:numel(indexTrigger),
triggeredSubs{i} = get_param(blockList{indexTrigger(i)},'Parent');
end
Hope this helps to get you started!

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by