Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Curious

Posts: 1,995
Registered: 12/6/04
Re: IF STATEMENT MATCHING NUMBERS
Posted: Jul 15, 2013 1:50 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"ALEX" wrote in message <ks1c3q$jg9$1@newscl01ah.mathworks.com>...
> 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


No need to shout!

Even though the numbers appear to be rounded to the tenths, MATLAB
cannot represent & store the number EXACTLY to the tenths. (Its not MATLAB's fault, thats simply a limitation of computers internally using binary numbers.)

For a more detailed explaination and a work-around see Q5.1 of the MATLAB FAQ:

<<http://matlab.wikia.com/wiki/FAQ>>

Specifically:

<<http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F>>



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.