I have a MATLAB function with the following code inside it:
function y = fcn(u)%#codegen
y =typecast(u,'double')
For example:
>> typecast(42.354887660341, 'uint8')ans = 147 117 119 245 108 45 69 64>>
If I feed this UINT8 to the Matlab Fcn Block (created with the Function above), in Simulink I get back the DOUBLE : 42.354887660341
But, with the generated code when I check the same value in DSPACE, I see a totally different value.
Why is this happening?
Best Answer