Eliminate events from the plot

조회 수: 1 (최근 30일)
aneps
aneps 2013년 12월 25일
답변: dpb 2013년 12월 25일
I have a data with three columns X, Y and T. X and Y represents positions of and event and T the corresponding time. What I did is, i have the following code to eliminate the events with (0,0) positions (X,Y), plot the histogram and plot (X,Y).
A=[X Y T];
A(any(A==0,2),:)=[];
figure(1)
[k,n]=hist(A(:,3)./1000,100);
plot(n,k,'*r')
figure(2)
plot(A(:,1),A(:,2),'.','markersize',12).
This is what I have. I want help in following:
I want to choose some regions from the XY plot (figure 2), eliminate those events from A (X,Y and T) and then plot the histogram of T, plot (X,Y).
Please give me code to do this.
PS: To make clear, my aim is to eliminate some unwanted events (using the mouse, selecting the regions with circles or rectangles by mouse click). So, first I plot the real data. Then choose from the XY plots the unwanted events (using mouse). Then eliminate those events from the original file and plot histogram and XY plot.
If it is not possible to choose different regions with separate circles or rectangles, I think, it can be done with some loop which repeat only if I say "Yes" or some number (1 for yes and 0 for No). so this may allow me to repeat the removing the regions up to the extend I want. Please tell me how can I make this loop in case of multiple region selection at a time is not possible.

채택된 답변

dpb
dpb 2013년 12월 25일
doc ginput % and friends
One "trick" in eliminating data from plotting is that plot (and friends) ignore NaN's in the data input so you can save a lot of resizing data and make your routines more flexible relatively simply if you simply mark the data with a NaN rather than resize the array entirely. You may also want to keep a corollary vector of the original points to be able to easily restore as well.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by