MATLAB: Can’t find_system find IC block

find_systemic blocksimulink

I would like to find all initial condition blocks in my Simulink model, yet the following returns an empty cell array,
thisBlock = find_system(bdroot, 'BlockType', 'IC')
Can you correct this call to find_system? When I click on the block, gcb returns 'myModel/IC', so I believe the block type is correct.

Best Answer

The IC block's BlockType is 'InitialCondition', so you should be using find_system(bdroot, 'BlockType', 'InitialCondition'). I would recommend using find_system(bdroot, 'LookUnderMasks', 'on', 'BlockType', 'InitialCondition') if you want to search inside masked subsystems also.