How do I find out whether a number is an integer in Matlab?
-
(I'm looking for the mathematical definition of integer as positive and negative whole numbers, not the Matlab integer class)
-
Answer:
The floating point math convention used by MATLAB (and everyone else) has limited precision. Round-off error, for instance, may leave numbers which should be true integers slightly off from integral values (like 17.00000000023 instead of 17). Assuming that this problem has not ballooned terribly in your calculations, you can try something like the following: abs(MyNumber - round(MyNumber)) < 0.00000001
actaha at Yahoo! Answers Visit the source
Other answers
In my last assignment, the method I used to determine if a number is integer is to round it up, then deduct it from the original number. If the result is zero, then it is an integer. Otherwise, it is not.
pateoh
if there is no inbuilt function, write an elementary function for yourself dude.
ZXSpectrumDX!!
Related Q & A:
- How can I find work as a writer?Best solution by Yahoo! Answers
- How do I find out if a business is legitimate?Best solution by bbb.org
- How do I find someone with a yahoo address?Best solution by Yahoo! Answers
- How do I find my SMTP server number?Best solution by Yahoo! Answers
- How can I find address from vehicle number?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.