MATLAB: In for loop, add same fractional value to all non-integers in the vector

ceilfloorfor loopindexintegers

Hello,
In vector A, I have values that are either integers or fractional values (all are X.3000). I'd like to add 0.2 to all fractional values, so that all non-integers are X.5000.
This is the code I have so far, and it's doing what I want it to, but only to the last value in the vector! What's the hiccough preventing it from being applied through the whole vector?
for i=length(A)
if floor(A(i)) ~= ceil(A(i))
A(i)=A(i)+.2;
end
end

Best Answer

HI balsip, try
for i = 1:length(A)