i-1 works if you iterate over i = 2:length(arr)

Reply via email to