MATLAB: How to find if a block is directfeedthrough in Simulink 7.2 (R2008b)

simulink

I have a model and I want to find out which blocks have directfeedthrough ports. Is there a way I can check if any specific block has a directfeedthrough port?

Best Answer

In order to find if a particular block has a direct feedthrough port, one has to create a run time object of the block. Once this is done, you can check the DirectFeedthrough property of the input port of the block for true or false. A true(1) indicates that the block is directfeedthrough while a false (0) indicates that the block is not directfeedthrough.
The following code snippet illustrates this feature. In this code, we are checking if the Product block in the VDP model is directfeedthrough or not. The directfeedthrough property of the input port handle returns 1 which indicates that the Product block has directfeedthrough ports.
vdp;
set_param(gcs,'StopTime','inf');
set_param(gcs,'SimulationCommand','Start');
rto = get_param('vdp/Product','RunTimeObject');
pH = rto.InputPort(1);
pH.DirectFeedthrough
set_param(gcs,'SimulationCommand','Stop');