Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: IF STATEMENT MATCHING NUMBERS
Replies: 2   Last Post: Jul 15, 2013 4:25 PM

 Messages: [ Previous | Next ]
 Derek Goring Posts: 3,922 Registered: 12/7/04
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(v1-v2) < tol
where tol is a small number like 1e-6.

Date Subject Author
7/15/13 ALEX
7/15/13 Curious
7/15/13 Derek Goring