2013-02-21 43 views
1

我有存儲在矩陣中的點雲座標。少數幾點與其他點分離。有誰知道我可以如何刪除它們?這些點顯示在圖片中。如果你能幫助我,我將不勝感激,因爲我不是數學傢伙:( 由於我是新用戶,我無法上傳圖片,但底部的點顯示了我想要刪除的4個分散點的數據集。如何刪除數據集中的分散點

 ....... 
........ 
    ......... 
    .........   . 
    ..........  .. 
    ......   . 
    ..... 
    ...
+0

我想你可以繪製點作爲一個圖形,然後使用方法在[這裏](http://mathematica.stackexchange.com/questions/3566/interactively-extract-points-from-刪除a-plot-listplot-or-smoothdensityhistogram)和[here](http://mathematica.stackexchange.com/questions/20066/how-to-interactively-select-points-inside-certain-region-in-a-plot )。 – xslittlegrass 2013-02-24 16:17:08

回答

1

下面是一些代碼,希望可以幫助你:

data = Table[{Random[], Random[]}, {100}]; 

DynamicModule[{p = {0.5, 0.5}, linePts = {}, p1 = {0., 0.}, 
    pts = data}, 
Manipulate[ 
    Graphics[{Dynamic[Point[pts]], Locator[Dynamic[p]], 
    Line[Dynamic[If[p != p1, AppendTo[linePts, p]; p1 = p]; 
     linePts]]}], 
    Row[{Button["updata", 
    pts = Select[pts, ! Graphics`Mesh`InPolygonQ[linePts, #] &]], 
    Button["copy points", Print[Flatten[Position[data, #] & /@ pts]]], 
    Button["Reset", linePts = {}; pts = data;]}]]] 

您在曲線繪製區域,然後在情節刪除「更新」按鈕,將顯示保持點「複製點「將複製剩餘點位置,」復位「將復位到原始圖。

enter image description here