LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting parts of data in a XY graph

Solved!
Go to solution

Good morning ,

I am pretty new to Labview and I would like to get help. 

I am building an FFT XY graph and wanted to know if it was possible to delete parts of that graph. 
The inputs are: 
  - dt : the frequency 
  - data float: response of my resonator 
They are both 1D array that I bundle and send to the XY graph. 

I want to plot the FFT between 10kHz and 15kHz (not only visually but also in the array) 

I tried to delete some of the dt array frequencies but ended up by shifting my graph. 

How can I delete the dt data so the data float values delete accordingly (How do I delete the X values and it's Y value simultaneously)  ?  

Thank you. 
aidelabview.PNG

0 Kudos
Message 1 of 12
(1,700 Views)

@Mazespin wrote:



How can I delete the dt data so the data float values delete accordingly (How do I delete the X values and it's Y value simultaneously)  ?  


I suppose, you can use conditional auto-indexing to leaf out those X,Y-points which meet your condition of "is outside"/"is inside"

Message 2 of 12
(1,680 Views)

the XY data to be plotted is bundle as a "cluster' 

LVNinja_0-1685626790326.png

 

You need to delete Both X and Y from the Arrays BEFORE they are bundled to plot. 

You said that the graph was shifted, probably because you need to replace the values by NaN:

- define the conditions of data to be deleted, and define an array with the index of data to be "deleted" then replace these indexes by NaN

 

LVNinja_1-1685627107147.png

 

Message 3 of 12
(1,650 Views)

dear Mazespin, would you post a demo.vi and some typical demo data e.g. as a .csv?

 

 

moreove and recently,  there was this discussion with a very similar topic:

- https://forums.ni.com/t5/LabVIEW/Selecting-unusual-shaped-regions-of-a-graph/m-p/4306783#M1258890

- https://forums.ni.com/t5/LabVIEW/How-can-I-rotate-a-box/m-p/3972975#M1132528

 

especially:

Spoiler
hacky_generic_rect.png
0 Kudos
Message 4 of 12
(1,643 Views)
Message 5 of 12
(1,618 Views)

You asked "How can I delete the dt data so the data float values delete accordingly (How do I delete the X values and it's Y value simultaneously)  ?"

 

I would answer "You should not delete anything."  Instead, make a copy of your Graph data.  What you really want to do is plot your XY graph where you don't "show" the XY values for data that fit some criterion -- here is it "Data whose X parameter is < 10 kHz or > 15 kHz.  All you need to do is to replace, on the copy, the Y values corresponding to the X values that you do not want plotted with the constant "NaN" (Not a Number), which you can find on the Numeric Palette.  When you plot the altered copy, it will only show the values that you left intact.

 

Bob Schor

Message 6 of 12
(1,462 Views)

@Mazespin wrote:

How can I delete the dt data so the data float values delete accordingly (How do I delete the X values and it's Y value simultaneously)  ?  

Thank you. 


If you pick a more reasonable data structure for your XY graph (for example a 1D complex array!), they x (=RE) and y (=IM) values are linked and all you need to do is delete one array element. No need for herding cats.

 

XY graphs understand complex arrays and will graph IM vs RE.

Message 7 of 12
(1,459 Views)
Solution
Accepted by Mazespin

"In Range and Coerce" can compare clusters. By default it uses "Compare Elements" mode, but if you right click and select "Compare Aggregates" then it just uses the first elements in the cluster:

 

Example_VI.png

 

You could do this with unbundle as well, and it might make your code a bit more readable, but that's the general idea.

Message 8 of 12
(1,445 Views)

@altenbach wrote:
XY graphs understand complex arrays and will graph IM vs RE.

Most likely your x-values are non-descending, so here's what I might do.

 

(Very rough draft that can be further optimized. You might also need to adjust boundary treatments according to the exact needs, i.e. include or exclude the boundaries.)

 

altenbach_0-1686077547557.png

 

Note that a graph is just a passive indicator. You need to operate on the data going into the graph.

Message 9 of 12
(1,437 Views)

For a real dirty LabVIEW Ninja trick...just set Y=NaN for the values you don't want displayed on the plot.


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 12
(1,420 Views)