MATLAB: How is the FIND_SYSTEM used to find “IF Action Subsystem” in Simulink 8.2 (R2013b)

ports.enablesimulink

I would like to find all "IF Action Subsystem" by using FIND_SYSTEM and assign subsystem values. 

Best Answer

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