for pop = 2:1:20
for ii = 1:1:4
A(ii) = ((Data.tend(1,pop-1)-Data.duration(1,pop-1)+1) - Data.tstart(1,pop-1)); %Matrix A
B(ii) = randi([0, A(ii)], 1); %Matrix B
chrom(ii) = Population(pop-1).chrom(pop-1) + B(ii);
end
Population(pop).chrom = int2str(chrom);
clear chrom
end
Does not stay within upper and lower bounds after 1st iteration.