Consider the following code:
function y = fcn %#eml
eml.extrinsic('square', 'linspace');
a = 1; dc = 50; f = 2*pi* (6908:1:9856);
t = f; % pre-allocation of f
t = linspace(0, 1000000, numel(f)); % re-assignment
y = t; % pre-allocation of t
y = a*square(t.*f, dc); % element wise multiplication and Then final assignment
If you will notice here, the pre-allocation solves the problem of difference in datatype. The compiler cannot determine the type and size of the outputs of extrinsic functions. Therefore, the compiler will be forced to keep it "MATLAB type" (AKA an mxArray). The only thing you can do with an mxArray in Embedded Matlab, is pass it onto another extrinsic function, but you cannot assign it to anything directly.
You'll have to tell MATLAB the type and size of the extrinsic function's output before calling the extrinsic function. You can do this by pre-alocating the variable with the same type and size of the (expected) output.
---This answer was given to me!!--- i didnt come up with it!! Hope it helps people!