Azzera filtri
Azzera filtri

Eliminate events from the plot

2 visualizzazioni (ultimi 30 giorni)
aneps
aneps il 25 Dic 2013
Risposto: dpb il 25 Dic 2013
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.

Risposta accettata

dpb
dpb il 25 Dic 2013
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.

Più risposte (0)

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by