Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing rows of 2 files

LABVIEW 8.5

 

Hi,

got a problem:

 

I´ve got 2 files:  GIL-file (measured with 4Hz) and GPS-file (measured with 1Hz)..

Each file has got different values, the first column is always the time. Now I want to calculate with columns from different files, but for that i must tell the program to allocate all values to the right timevalues (Gilfile starts at sec 0 and has 4 values/sec, while GPSfile starts at sec 1 and has got 1 value/sec)...

 

I want to have the higher resolution (4Hz) , so i think, if i compare both time columns, the program automatically will work with the higher resolution (4-liner), so that first i don´t have to write each row of GPSfile 4 times....

 

NOTICE: time columns must be reduced to integer, so that comparison works correctly...

 

I tried to do that, but there is a point, where i do not have any ideas...

Can anybody help me?

 

 

Download All
0 Kudos
Message 1 of 16
(5,026 Views)

Ahh.... I´m dying....

I need a hint...if someone knows one....^^

 

this is my actual version, no more ideas

0 Kudos
Message 2 of 16
(5,006 Views)

Hi Lecojon,

 

you say you want to use the correct timevalues with the right values - do you need the time to make a calcualtion? Because if yes, you cant just round the...

 

Next question is you say that you want to use the 4Hz as timebase, but then you only take the values which from 1Hz (at least thats how I understood it). 

 

 

To me it sees that you either way have to reduce or interpolate your data depending what you want:

1. Using 1 Hz:  just take the right time values form the GIL-File eg. 1.3, 2.3 etc. and ignore the other rows.

 

2. Using 4Hz: interpolate the GPS-File that you will get for each time value of the GIL-File a corresponding interpolated value for the GPS-File.

 

It depends on you, what you want to make. I couldnt read it in your post...

 

I hope this gives you an idea. And if I am wrong - just explain again 😉

 RMathews

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 3 of 16
(4,991 Views)

huhu..again ^^....

 

What you said, i´ve already done... i took the 1Hz Data and i wrote each row 4 times, so the amount of Data was equal...

But I´m looking for a way, that i take f.ex. time col from 4Hz Data and any col from 1Hz Data....

and i let the prog know: write the values to the corresponding  time...

 

Well, in fortran i just had to write it like this (maybe it´s more understandable)

 

if (time1==time2)then

"calculate"

end if   ...............time1 and time 2 are integers, necessary for comparison....in this way, fortran took each value from 1Hz data and automatically wrote that value as often as the second of 4Hz Data was equal....

 

 i have                                             and (first col is always the time)

 

    0.0,-012.96,+000.53,00                  1.30, 82800,  49.016503,   8.437605,  13.48, 231.18  

    0.3,-013.21,+000.30,00                  2.30, 82801,  49.016426,   8.437457,  14.01, 231.91
    0.5,-013.33,+000.33,00
    0.8,-013.51,+000.31,00
    1.0,-013.49,+000.40,00
    1.3,-013.70,+000.26,00
    1.5,-013.81,+000.27,00
    1.8,-014.00,+000.21,00
    2.0,-014.26,-000.30,00
    2.3,-014.39,+000.17,00
    2.5,-014.61,+000.23,00
    2.8,-014.66,-000.01,00


 After comparison there would be

 

    1,-013.49,+000.40,00,  82800,49.016503,   8.437605,  13.48, 231.18

    1,-013.70,+000.26,00,  82800,49.016503,   8.437605,  13.48, 231.18

    1,-013.81,+000.27,00,  82800,49.016503,   8.437605,  13.48, 231.18
    1,-014.00,+000.21,00,  82800,49.016503,   8.437605,  13.48, 231.18
    2,-014.26,-000.30,00,   82801,49.016426,   8.437457,  14.01, 231.91
    2,-014.39,+000.17,00,  82801,49.016426,   8.437457,  14.01, 231.91
    2,-014.61,+000.23,00,  82801,49.016426,   8.437457,  14.01, 231.91
    2,-014.66,-000.01,00,   82801,49.016426,   8.437457,  14.01, 231.91

 

is there a simple way to realize that with LV? if not, so i really have to solve that by copying rows and right array indexing

 

0 Kudos
Message 4 of 16
(4,982 Views)

Hi there,

 

copy and paste would be the right thing to do for you!

 

🙂

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 5 of 16
(4,978 Views)
THIS MUST BE THE SOLUTION! LOL!
0 Kudos
Message 6 of 16
(4,976 Views)

Ah, sorry, I obviously ment doing it with LabVIEW and the array-functions, not by hand.

Important is that you use the right dimension. In the second VI you get a 3D-Array and thats not what you want. So you have to use the Insert into Array-function and not "build array".

 

I hope its clearer now... 

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 7 of 16
(4,965 Views)

Hm, i think i´m too stupid for things like these, i solved the problem, i first copied each row 4 times, but then i found a mistake in 4 Hz measure data, it was like this:

    

    4 Hz Data                                         1 Hz Data

    0.0,-012.96,+000.53,00                  1.30, 82800,  49.016503,   8.437605,  13.48, 231.18  

    0.3,-013.21,+000.30,00                  2.30, 82801,  49.016426,   8.437457,  14.01, 231.91
    0.5,-013.33,+000.33,00
    0.8,-013.51,+000.31,00

    1.3,-013.70,+000.26,00      <-----VALUE MISSING (3 values instead of 4)
    1.5,-013.81,+000.27,00
    1.8,-014.00,+000.21,00
    2.0,-014.26,-000.30,00
    2.3,-014.39,+000.17,00
    2.5,-014.61,+000.23,00
    2.8,-014.66,-000.01,00


so if i copy each row of 1Hz File 4 times, a mistake will come into being.... what i would like to do is, that the program compares the integer value of 1st column (red ones) and writes rows of 1Hz data just as often as integer value exists....

so at second 1.3-1.8 row of 1 Hz Data with integer time value 1 should just be copied 3 times instead of 4....

 

How can i do that? i´m going crazy with that 😄

0 Kudos
Message 8 of 16
(4,954 Views)

 

Hi Lecojon,

 

can you post your vi?

One more questions:

The first 4 rows with the zero... Do you want to just ignore them and cut them out? Thats how I understand it...

 

RMathews

 

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 9 of 16
(4,941 Views)

Hi Lecojon,

 

here I have an example. I am not sure if it really fits you, but it should give you some ideas...

 

Byebye

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
0 Kudos
Message 10 of 16
(4,938 Views)