MATLAB: ‘Matlab Coder’ generated code is NEVER of double type (only real_T)

clegacy codematlab coders-functionsimulink

I'm trying to convert a piece of matlab code into C++ code. I have one large vector (100+ elements) as input and one large vector as the output. Now, when I try to build the code using the Matlab Coder, while explicitly specifying that the input variable (u) is a DOUBLE, Matlab just seems to ignore my demands and does its own thing by creating the function with input variable of the type const real_T type instead.
This would not be so bad except that I need to use the resulting code with the Legacy_Code function in order to create an S Function. What can I do?
[Attached screenshot shows what is wrong]

Best Answer

Notice that if you do not include the include file indicated there, you could go ahead with the legacy code tool and create the equivalence: http://www.mathworks.com/help/simulink/slref/legacy_code.html
legacy_code('compile', specs, compilerOptions)
example:
legacy_code('compile', s,...
{'-DCOMPILE_VALUE1=1', '-DCOMPILE_VALUE2=2',...
'-DCOMPILE_VALUE3=3'});
So you could '-Dreal_T=double'