I believe your problem is your call to 'find' around like 50 of be_alam.m. 'find' returns a variable size vector as its result. This will be the proximate cause of the "dynamic matrix type". HDL Coder needs all variables to have a fixed size at all times.
I think you will have to implement the 'find' functionality explicitly, returning a single value.
min_dis = min(dis);
for ii = 1:numel(dis)
if dis(ii) == min_dis
n = ii;
end
end
