Embedded coder - how to control types of temporary variables within embedded Matlab function blocks

5 次查看(过去 30 天)
I'm generating code from simulink using embedded coder. In my simulink model I have an embedded matlab function containing the matlab command eig. When I try to compile the generated c-code in microCforPic32 I get errors on out of range numbers. In matlab double precision is standard, but my target processor is 32 bit, so I guess I would like to use single precision but dont see how I can set this for the temporary variables generated from matlabs own functions such as eig(). Below is part of the generated code:
/* Function for MATLAB Function: '<S17>/Eig' */ static void Calib_eml_matlab_ztgevc(const creal_T A[4], creal_T V[4]) {...
Heres one of the lines within this function that cause troubles y = anorm; if (2.2250738585072014E-308 > anorm) { y = 2.2250738585072014E-308; }
The tpe of y is defined in top of the function
real_T y;
Where real_T stands for double 64-bit, i'm pretty sure.
I've tried to set the largest atomic size to float but does not change the value 2.2250738585072014E-308. I could of course change it mannualy in the c-code but I would prefer to solve it in matlab.

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by