MATLAB: How to write the C S-Function in order to have non-virtual bus (with different data types inside) as input in Simulink 6.6 (R2007a)

simulink

I would like to write my own C S-function which inputs are non-virtual bus. I do not succeed. If I generate the S-function with RTW that works. I would like to know if this can be done manually.

Best Answer

The ability to use buses as input or output of an Hand-written C MEX S-function is not available in Simulink 6.6 (R2007a) as mentioned in the documentaiton :
<http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/index.html?/access/helpdesk/help/toolbox/simulink/sfg/brgo03i-5.html>
To work around this, you can use Legacy Code Tool to import existing C code by looking at the following demo 'Calling Legacy Functions with Structure Arguments Using Buses'. You can open this demo by typing the following on MATLAB Command Prompt:
sldemo_lct_bus_script