Azzera filtri
Azzera filtri

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

4 visualizzazioni (ultimi 30 giorni)
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???

Risposte (1)

Walter Roberson
Walter Roberson il 15 Feb 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.)

Categorie

Scopri di più su Geographic Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by