Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: IF STATEMENT MATCHING NUMBERS
Posted:
Jul 15, 2013 4:25 PM


On Tuesday, July 16, 2013 5:39:07 AM UTC+12, ALEX wrote: > I'M BAFFLED BY THIS, I HAVE ROUNDED TWO SEPARATE COLUMNS FROM TWO DIFFERENT MATRICES. I WANT TO MATCH AN ELEMENT FROM ONE COLUMN WITH AN ELEMENT FROM A DIFFERENT COLUMN. THESE ARE NUMBERS WHICH HAVE BEEN ROUNDED TO THE TENTH. FOR SOME REASON THE IF STATEMENT ONLY ADDRESSES HAVE OF THE NUMBERS WHICH ARE IDENTICAL. NOT SURE WHY IT IS DOING THIS. ANY IDEAS? > > > > FOR BACKGROUND, I WANT TO MATCH THE TIMESTAMP FROM TWO DIFFERENT SETS OF DATA. ONE DATA SET IS AT 1/10 SEC INTERVALS, THE OTHER IS 2/10 SEC INTERVALS. > > > > THANKS SO MUCH
Are you shouting intentionally, or have you inadvertently hit the Caps Lock?
For comparison of floating point numbers, you need to replace: if v1==v2 with if abs(v1v2) < tol where tol is a small number like 1e6.



