I have a nested if statement that states if the condition is not met run another script and then compare again until it meets the condition or meets the maximum iterations.
unk_row = 6for it_cnt = 1:20 % for all elements in del_hat_cal (6 coords)
for unk_cnt = 1:unk_row if (abs(del_hat_cal(unk_cnt,1))) < sqrt(C_x_hat(unk_cnt,unk_cnt)) del_hat_cal = del_hat_cal % else if any of the values dont meet the requirements => run the iteration
% subroutine.
else IterationSubscript_1_2 end disp ('Iterations') disp(it_cnt) end
The code executes correctly until the second iteration of it_cnt
It then says that the if statement is met and del_hat_cal = del_hat_cal.
I.e. that
0.001025046924337550.0008928426476183510.003480976221681410.003065793219369510.003155617239715640.000665510381349233< sqrt [1.20641569956672e-059.90305275269894e-063.62427182962373e-052.53803334328813e-054.60943640122694e-051.44380191794682e-05 ]
Does anyone know why in the second iteration for it_cnt MatLab shows the condition is met, thus del_hat_cal = del_hat_cal ?
Best Answer