I have attached two parts(part 1 and part 2) from my script and there are few parts like this and I want to simplify these hard coded statements. For easyness, I have attached two different statements only in here which means I just want understand my weakness once somebody guided me. All these i,j,k values are in 1:10 range. just expecting two different simplified statements for part(1) and part(2).
if ((j==1)&&(k==1)||(j==2)&&(k==2)||(j==3)&&(k==3)||(j==4)&&(k==4)||(j==5)&&(k==5)||(j==6)&&(k==6)||(j==7)&&(k==7)||(j==8)&&(k==8)||(j==9)&&(k==9)||(j==10)&&(k==10))&&((i==1)||(i==10)); B(i,j,k)=1; else B(i,j,k)=0;%----------part (1)
if ((i==10)&&(j==1)||(i==9)&&(j==2)||(i==8)&&(j==3)||(i==7)&&(j==4)||(i==6)&&(j==5)||(i==5)&&(j==6)||(i==4)&&(j==7)||(i==3)&&(j==8)||(i==2)&&(j==9)||(i==1)&&(j==10))&&((k==1)||(k==10)); B(i,j,k)=1; else B(i, j,k)=0;%----------part(2)
Best Answer