Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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???

Respuestas (1)

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

Categorías

Más información sobre Geographic Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by