LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remove data points before rising edge and falling edge of a plot

Hi,

     I am trying to fix the horizontal axis of a plot. It can get very narrow because the data points are distributions values. In cases that it does get narrow, I would like to zoom in on it by making the axis tighter which means removing the data points when my Y values is 0 before the rising edge of the plot and after the falling edge of it.

I have a file showing an example of what the plot may look like sometimes.

I can extract the data from excel but I don't know  how to removed those values or do some tricks with the x axis to make it tighter using Labview excel activex. Can someone help me?

0 Kudos
Message 1 of 10
(3,228 Views)

Looks to me like your data is a very simple 1D array of numbers.  If you already know how to read them into LabVIEW then you are half way there.  If you want to iterate through values in an array and return anything that is not zero, then do this:

 

Remove Zeros.png

 

Is that what you want to do?

0 Kudos
Message 2 of 10
(3,190 Views)

no not at all.

I want to remove the zeros before the start rising edge of the plot and after the falling edge of it. Because there will be zeros in the middle of the plot. In other words I want to make the X axis a little tighter programmatically because the plots will vary at each iteration of data file that I process.

Once I am thinking If I  can detect the first rising edge of the plot, I can set the starting axis X point to be 5 points before it. And if I detect the last falling edge of the plot I can set the ending X axis limit to be 5 data points after it.

 

I attached a file showing what the raw plot would look and how I want to modify it

0 Kudos
Message 3 of 10
(3,170 Views)

Hi ritch_by_nature,

 

You are right that this problem becomes trivial once you can identify the first rising edge and the last falling edge. The first edge could be detected by measuring the first time the signal rises above a certain threshold. The last edge could be detected using the same process, but starting at the end of your array and decrementing the index.

 

Best,

 

Duncan W.

0 Kudos
Message 4 of 10
(3,163 Views)

Also I wanted to clarify I am not generating a real time  signal.. It's a 2D array from a saved data file

0 Kudos
Message 5 of 10
(3,159 Views)

Example_VI.png


"Should be" isn't "Is" -Jay
Message 6 of 10
(3,157 Views)

Not a bad solution but this create another issue. As my graph changes setting up a fixed threshold don't quite work.

Also I want to clarify although your technique works for reading a file directly and plotting it. It doesn't work for my code because I am setting the max and min axis values using excel activex. I tried getting the max and min of subarray 2 for my x-axis using your code but it didn't work.

0 Kudos
Message 7 of 10
(3,139 Views)

That is exactly why I created this Malleable VI later that day.  It takes an array of points or an array of EXT, DBL, SGL or INT. (sorry, no Complex or Fixed Point support) Trim Array.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(3,133 Views)

Thanks, I had already manage to get to that part. But presetting my threshold is not working when I go through many data files to plot. Assuming That I want to modify my X axis only. Attached is of what I am trying to do when it comes to setting the axis only.

  I tried using the max and min values of your final subarray and feed it to my x axes MaximumScale and MinimumScale Methods but it did not work 

0 Kudos
Message 9 of 10
(3,121 Views)

Scale the Y axisSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 10
(3,112 Views)