フィルターのクリア

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

4 ビュー (過去 30 日間)
Charles David
Charles David 2013 年 2 月 15 日
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???

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 2 月 15 日
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.)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by