MATLAB: How to connect a bus to an S-function generated using Legacy Code Tool in Simulink 7.4 (R2009b)

simulink

I have an S-function generated from a legacy C-function using the Legacy Code Tool (LCT). I need to connect a bus input to this S-function, and receive a bus output from it.

Best Answer

The attached zip file "1-BL1XX7.zip" contains a model "businputandoutput.mdl" that demonstrates how to feed a bus input and receive a bus output from an S-function generated using Legacy Code Tool. Apart from the .mdl file, the zip file also contains the following attachments:
1. doubleIt.c: Legacy C-function
2. commonHeader.h: Legacy header file to the C-function
3. sfun_generate_script_double.m: Script to generate S-function using Legacy Code Tool from the above two C files
4. foo_data.mat: The .mat file that defines the bus signal that is fed as input to the S-function
5. ex_sfun_doubleit.c: S-function generated from files (1) and (2) above, by executing the MATLAB script (3) above.
6. ex_sfun_doubleit.mexw32: MEX-file corresponding to the S-function (5) above.