MATLAB: Can I build the S-Function Builder Block from the command line in Simulink 7.1 (R2008a)

simulink

I have a model that contains an S-Function Builder Block. I have generated the code from this model but I would like to compile (mex) the code for another platform that I can only access via a network connection. Because of the nature of the connection I cannot open the S-Function Builder Block's GUI and therefore cannot click the 'Build' button.

Best Answer

The S-Function builder block creates 3 files when you click the 'Build' button
sfun.c
sfun_wrapper.c
sfun.tlc
where 'sfun' is the name of the S-function that you specify.
If you have these files already you only need to create a MEX file for the new platform which can be done by executing the following command in a MATLAB command window on the platform you would like to compile for.
mex sfun.c sfun_wrapper.c
For more information please see the documentation section titled 'Building S-Functions Automatically' or execute the following in MATLAB 7.6 (R2008a):
web([docroot '/toolbox/simulink/sfg/f8-93720.html'])