A common way people do things like this is with an if statement. For the condition of the if statement you need to relate it to a. There is a function called modulus which outputs the remainder of a division between two numbers. This can be used as such:
for a = 1:100
if(mod(a,4)==0)
y = updatedY
end
end
Depending on what you want you may need to change the 4 to a 5.
The way modulus works is that every time a is a multiple of 4 the output will be 0 and so y will be updated.