If you assign an empty matrix  to variable-size
data, MATLAB® might silently reshape the data in generated code
to match a coder.varsize specification. For example:
function Y = test(u) %#codegen
Y = ;
coder.varsize('Y', [1 10]);
if u < 0
Y = [Y u];
In this example, coder.varsize defines Y as
a column vector of up to 10 elements, so its first dimension is fixed
at size 1. The statement Y =  designates the
first dimension of Y as 0, creating a mismatch.
The right hand side of the assignment is an empty matrix and the left
hand side is a variable-size vector. In this case, MATLAB reshapes
the empty matrix Y =  in generated code to Y
= zeros(1,0) so it matches the coder.varsize specification.