I don't know why you want to write the code with for loop but this might work.
time = yourTime;
dt = diff(time)
v = yourSpeed;
dv = diff(v)
a = zeros(length(dv),1);%acceleration
for i = 1:length(time)-1
a(i) = dv(i)./dt(i)
end
But better you use
a= dv./dt;