Typically, you have to right-click on a subsystem, choose Real Time Workshop -> Generate S-Function in order to replace a standard Simulink subsystem with an S-function.
With ss2sf, you can provide a cell array of subsystem paths and the function will replace the specified subsystems with their s-function equivalents.
This works fine when you don't use busses. When a bus is used you can get error messages like this:
'model/subsystem' must be connected to a Bus Creator, Bus Selector or a block that outputs a bus using a bus object. It can also be connected to bus capable blocks that meet the conditions for supporting buses provided the bus entering the block has been created by using a bus creator.
The internal S-Function Generator works somehow different. It seems to split the bus signals into single signals. An information how that works would be appreciated.
Added License Info.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.