MATLAB: How to find all the blocks connected to a start block in simulink using matlab code

codeMATLABscriptsimulink

I'm trying to make a script that finds all connected blocks to a start block or set of blocks in a simulink model. How can i do it?

Best Answer

portCon = get_param(youBlockHandle, 'PortConnectivity');