Effacer les filtres
Effacer les filtres

is there any way to check if any point exactly overlaps with another point?

4 vues (au cours des 30 derniers jours)
Charles David
Charles David le 15 Fév 2013
I basically have data in many files.i.e latitude longitude and temperature. Now when a new file comes in i want to be able to check if any record has the same latitude and longitude combination and if it does i want to ignore it.I know it can be done through a program but i think it will take a very long time to check this for every particular record and may take around O(n^2).Is there any other way to do this???

Réponses (1)

Walter Roberson
Walter Roberson le 15 Fév 2013
How are the latitude and longitude represented? If they are floating point numbers, then you will have a problem. See http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
If you use a binary search, then you can determine match or not in log2(n) time, and so can do all of the checks in at most O(n*log(n)) time. O(log(n!)) time really. Excluding the cost of the insertions (which would be at the point the match was determined not to exist.)

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by