LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need to extract only one data point per second

Good day. I have vibration data in txt format. The problem is for each second there are about 4 data points. For example, for 0 seconds, the amplitudes are -0.897,-0.9191,-0.891,1.021. I want to pull out only the first data for each second  into an array. How I should do that in labview?

0 Kudos
Message 1 of 13
(3,654 Views)

How is the data arranged in the file? If you have one row per second, load the entire file into a 2D array with four columns, then get the first column using "index array". Check the help on how to wire it up.

0 Kudos
Message 2 of 13
(3,646 Views)

please refer to the picture.

 

 i want to extract from 0s, 0.0001s, 0.0002s....1s... i want labview to read and extract only first data for each second..how to make it using for loop

0 Kudos
Message 3 of 13
(3,639 Views)

Here's a simple example:

IndexArrays.png

In this case, you're getting the first value every "1" in the first column. If you wanted a different timestep, change the threshold (currently wired to "i") in the second For loop.

The first pair of For loops generate some example data.


GCentral
0 Kudos
Message 4 of 13
(3,624 Views)

So you want to keep all rows where the value in the first column is different from the previous row? This is not every second, but every small fraction of a second.

 

All you need is a FOR loop, a shift register, and a conditional indexing output tunnel.

 

Where does the data come from? Is the first column guaranteed to be nondescending? Are you sure adjacent similar values are truly equal or do you need to protect from potential issues comparing floating point values?

 

It is important to fully define the problem and so far you have not.

 

If you have LabVIEW 2019, you could make a simple solution using a map.

 

 

0 Kudos
Message 5 of 13
(3,616 Views)

Can you attach a vi? I think that I know what you have, but the vi would verify that and provide better opportunity for help.

0 Kudos
Message 6 of 13
(3,599 Views)

Are you specifically interested in the instantaneous measurement each second, or are you more interested in the average?  You could read every fourth measurement, or you could average the values of each group of four.  The latter approach would exhibit less apparent noise.

0 Kudos
Message 7 of 13
(3,578 Views)

Since all four measurements have the same timestamp, l am assuming that you have four sensors. If not, please explain the experiment in more details.

0 Kudos
Message 8 of 13
(3,564 Views)

0                 1.05601                            to              0                 1.05601 

0                 0.98198                                             0.0001         0.87057

0                 0.947786                                           0.0002       0.315342

0                  0.925151

0.0001         0.87057

0.0001        0.801475

0.0001        0.699657

0.0001       0.603108

0.0001      0.534849

0.0001       0.440993

0.0002       0.315342

0.0002       0.206156

 

from this input array (left), i want to get the output like this right array. take first data for each second..

remarks:

first column is seconds, right column is amplitude

0 Kudos
Message 9 of 13
(3,550 Views)

0                 1.05601                            to              0                 1.05601 

0                 0.98198                                             0.0001         0.87057

0                 0.947786                                           0.0002       0.315342

0                  0.925151

0.0001         0.87057

0.0001        0.801475

0.0001        0.699657

0.0001       0.603108

0.0001      0.534849

0.0001       0.440993

0.0002       0.315342

0.0002       0.206156

 

from this input array (left), i want to get the output like this right array. take first data for each second..

remarks:

first column is seconds, right column is amplitude

Download All
0 Kudos
Message 10 of 13
(3,549 Views)