Hi Mischa,
for i = 1:u(1,1)
if mod(delta(i,1),2) == 0
delta(i,1) = delta(i,1)
%number is even
else
delta(i,1) = delta(i+1,1)
%number is odd
end
delta= delta- delta/2 + 1
end
returns :
2
2
2.0625
2.09375
2.125
2.125
and not [2,2,3,3,4,4]
I have proceeded with some different code but the variable i does not update when the iteration runs through.
for i=1:6
%x_val = n
if x_val ==n
delta(i,1) = x_val
else %x_val~= n
x_val = n
delta(i,1) = x_val
end
% y_val to = x_val
if y_val==x_val
delta(i+1,1) = y_val
else
y_val=x_val
delta(i+1,1) = y_val
end
n=n+1
i=i+2
end
prior to the end of the command i returns the value of 3 for the first iteration but for the second iteration it reverts back to the count 2.