I need to perform while loop many times as follows;
data=xlsread('data.xlsx','B1:B86640');% first part
i_1=1;while (abs(data(1)) > 0.10 || abs(data(2)) > 0.10 || abs(data(3)) > 0.10) i_1=i_1+1; if i_1==361; errordlg('iteration cannot be converged', 'Error!', 'modal') return endend% second part
i_2=1;while (abs(data(362)) > 0.10 || abs(data(363)) > 0.10 || abs(data(364)) > 0.10) i_2=i_2+1; if i_2==361; errordlg('iteration cannot be converged', 'Error!', 'modal') return endend%third part
i_3=1;while (abs(data(723)) > 0.10 || abs(data(724)) > 0.10 || abs(data(725)) > 0.10) i_3=i_3+1; if i_3==361; errordlg('iteration cannot be converged', 'Error!', 'modal') return endend
After these excecutions, I need to store i_1, i_2 and i_3 arrays.
% for all abs(data(xx)) parts, xx equals to array of 1:361:86280;
How can I execute the above steps avoiding the repeated parts using a single part of different codes?
Best Answer