Good evening, I'm generating C++ code from a model in Simulink using the Embedded Coder toolbox, in which are present some MATLAB functions. In the generated code I saw that the variable names present in the Matlab function blocks of the model are changed with other variable names. For example the next are the lines of MATLAB code I used in one of the MATLAB function blocks:
function K_ec_bar = K_control(T, ec_bar_d, ec_bar, Ac_CT, Bc_CT, mu_K)
eig_des_K_control = exp(mu_K*T);
poly_K=conv([1 -eig_des_K_control(1)],[1 -eig_des_K_control(2)]);
The generated C++ code for this part is:
eig_des_K_control_idx_0 = std::exp(U.mu_K * U.T);
b2 = std::exp(U.mu_K * U.T);
Ac_DT = -14.014686154499964 * U.T + 1.0;
Bc_DT = 11.449906988970557 * U.T;
kp = (((-eig_des_K_control_idx_0 + -b2) + Ac_DT) + 1.0) / Bc_DT;
Ac_DT = ((Bc_DT * kp - Ac_DT) + -b2 * -eig_des_K_control_idx_0) / Bc_DT * DW_l.ec_bar_Delay_DSTATE + kp * ec_bar_d;
In this case the variable "eig_des_control" (a 2x1 vector) is splitted in 2 variables, the code generator called them as "eig_des_K_control_idx_0" and "b2": the last one is called with another variable name I've used in another part of the model.
This is not the only case, I saw many of this changes in my generated code.
I want to know if there are code generation settings or naming rules for these function blocks to avoid this mixing of names, and possibly select what name give to the variables in the final code.
Thanks in advance