The issue is in initialisation gesgroup
is initialised with size 1x2 but the line
gesgroup = [group, horgroup];
will make it 1x4 ( as both group and horgroup are 1x2), you need to initialise it as such or as variable size
e.g.
gesgroup = zeros(1,4);
or
coder.varsize('gesgroup')
I think the problem has occurred as the size is determined before coder.varsize('gesgroup')
is reached, so the array is already fixed size