Add two lines at the end of the script like this:
string = {'Figure 1','Figure 2','Figure 3','Figure 4'}; %%% or any titles you want
for i = 1:4
figure(i)
title(string{i}) %%% add this line
h = get(gcf,'Children');
newh = copyobj(h,5)
for j = 1:length(newh)
posnewh = get(newh(j),'Position');
possub = get(ax(i),'Position');
set(newh(j),'Position',...
[posnewh(1) possub(2) posnewh(3) possub(4)])
end
delete(ax(i));
end
figure(5)