Hi I am having trouble with my selection of if statements to sort out a minvalue grab from my array. In previous code the min function incorrectly grabed the wrong value that wasnt even close to being the minimum value in the array. To try and correct this mistake I made a series of If Statements that account for the changing poitions of the value real value trying to be detected through ranges. Xep is the value that is stable and doesnt have a problem with finding its measured location. Xbp is the error problem. The two variables should be no more than pixels away from each other and when they are this error occurs and I try to fix it with these If Statements:
if(20 <= (Xep – Xbp))
if(450<=Xep<=500) j=450; while DC1(1,j) ~= min(DC1(:,450:500)),DC1(1,j); Xbp = j; j=j+1; end end if(350<=Xep<=449) j=350; while DC1(1,j) ~= min(DC1(:,350:450)),DC1(1,j); Xbp = j; j=j+1; end end if(250<=Xep<=349) j=250; while DC1(1,j) ~= min(DC1(:,250:349)),DC1(1,j); Xbp = j; j=j+1; end end if(150<=Xep<=249) j=150; while DC1(1,j) ~= min(DC1(:,150:249)),DC1(1,j); Xbp = j; j=j+1; end end if(1<=Xep<=149) j=1; while DC1(1,j) ~= min(DC1(:,1:149)),DC1(1,j); Xbp = j; j=j+1; end endend
Xbp: 45 Xep: 417
I am unsure why this error is occuring as my If Statements seem to make sense to be. But when the code runs into the error with values like the two above, nothing happens and the code just skips over the If Statements like their not there.
Can someone please help me with this?
Best Answer