MATLAB: Do I get the error message that the arguments are not recognized with the Legacy Code Tool in Simulink 6.5 (R2006b)

simulink coder

I am using the legacy code tool to add legacy code to my Simulink model. When I try to generate the mex function with the command
legacy_code('sfcn_cmex_generate', def);
I get the following error message:
??? Error using ==> lct\private\pParseFcnSpec
Argument 'single c1' not recognized (in expression: 'single y1 = filter(single u1[1], single c1, single c2)').

Best Answer

This error is due to invalid signal and parameter naming in the OutputFcnSpec. The signals must be named u1,u2,... un and the parameters must be named p1,p2, ... pn. For example:
def.OutputFcnSpec = 'single y1 = filter(single u1[1], single u1, single u2, single p1)';
This is to distinguish between signals and parameters. The signal and parameter names used in the source and header files may be different.
For information on how Legacy Code Tool works type the following at the MATLAB command prompt:
web([docroot,'/toolbox/simulink/sfg/bq4g1es-1.html#bq4g1es-9'])