How are you keeping track of the 1 second intervals?
Maybe the process of taking the image and storing it takes longer than .5 and then the code pauses for another .5 seconds resulting in too few images.
Try calculating the pause time dynamically.
w = webcam;
t0 = clock;
secondsPassed = 0;
while etime(clock, t0) < 1000
secondsPassed = secondsPassed + 1;
img = w.snapshot;
file_name_save= sprintf('%f.png',toc);
imwrite(img,file_name_save)
% calculate the remaining time until the next image shall be taken.
time2wait = secondsPassed - etime(clock,t0);
pause(time2wait)
end
clear camObject;