Hi,
According to your description there doesn't seem any need for nested loops. Try making use of the following code:
outputVideo= VideoWriter('newfile.avi');
open(outputVideo);
for ii = 1: 2: length (imageNames)
kk=ii+1;
img1 = im2single (imread (fullfile (workingDir, 'images', imageNames {ii})));
image_2 = im2single (img1 + output_cross_alfa);
img2 = im2single (imread (fullfile (workingDir, 'images', imageNames {kk})));
image_1 = im2single (img2 + output_cross_Nalfa);
output = image_1;
writeVideo (outputVideo, output);
output = image_2;
writeVideo (outputVideo, output);
end
close(outputVideo);
Hope it helps.
Best Answer