why I'd get this error: The left-hand side has been constrained to be non-complex, but the right-hand side is complex. To correct this problem, make the right-hand side real using the function REAL, or change the initial assignment to the left-hand side variable to be a complex value using the COMPLEX function When setting up my fields in coder I specifically put the variable as a complex variable. Do I need to explicitly put that in my code as complex? If so, how do I do that? Here is my line of code tripping the error: yvec1(:,tic_ct) = DelayProfile .* (Fade1.Ix + 1i * Fade1.Qx); Any ideas?
Neeta Dsouza answered .
2025-11-20
MATLAB Coder automatically renames variables. These two lines are actually constraining two separate variables.
yvec1 = complex(zeros(M,N),zeros(M,N)); yvec1 = zeros(Fade1.num_taps,tics);
If you delete the first line and replace the second line with this you should be set.