The ability to query a subsystem directly to see if it is an If-Action-, Triggered-, Enabled-, or Function-call subsystem is not available in Simulink.
As a workaround query the subsystem to see if it contains an action port with the following commands:
ports = get_param(subsystem,'PortHandles');
conditional = ~isempty(ports.Enable) || ~isempty(ports.Trigger) || ~isempty(ports.Ifaction);
For instance, you can find and assign values to If-Action subsystem with the following commands:
b=find_system(gcs,'LookUnderMasks','all','BlockType','SubSystem');
for j=1:numel(b)
ports = get_param(b{j},'PortHandles');
if (~isempty(ports.Ifaction))
...
end
end
Best Answer