08-11-2022 10:00 AM
Hello everybody,
It's the first time I publish a question on the forum but I don't find any answer on internet.
I have Labview 2019.
My aim is to compare two text files.
First file (date time; value 1;value 2;value 3)
Second file (date time; value 4;value 5;value 6)
I want to create a new text file
New one (date time;value 1;value 2;value 3;value 4;value 5;value 6)
The following VI works for few amount of data. But I may have more than 10000 values.
I join you my VI.
You need to enter on the first file link the HOBO file and on the second the RBR file and change the enum to RBR.
If I am not clear tell me.
PS: I know my VI is not very clean.
Thanks a lot,
Adrien Bonnefoy
Solved! Go to Solution.
08-11-2022 02:17 PM
Your code is hard to read; it's bigger than my monitor.
It's not clear what you want to do.
From the HOBO-2 File:
Titre de tracÈ : 20794806;;;
Date;ConductiviteLR;ConductiviteHR;Temperature
08/07/2022 05:30:00;0.9;0.8;22.51
08/07/2022 05:30:07;1;0.8;22.52
08/07/2022 05:30:08;2.3;0.8;22.52
08/07/2022 05:30:09;1;0.8;22.52
From the RBR-2 file:
Time;Pressure;Sea pressure;Depth
08/07/2022 05:30:00;10.19203465;0.059534648;0.059049164
08/07/2022 05:30:01;10.19192678;0.059426776;0.058942172
08/07/2022 05:30:02;10.19180169;0.059301695;0.058818111
08/07/2022 05:30:03;10.19187774;0.059377743;0.058893539
08/07/2022 05:30:04;10.191966;0.059466002;0.058981078
08/07/2022 05:30:05;10.19213271;0.059632713;0.059146429
08/07/2022 05:30:06;10.19243672;0.059936715;0.059447953
08/07/2022 05:30:07;10.19204445;0.059544454;0.05905889
It looks like RBR has time every second, but HOBO has gaps.
What do you want to do with those gap cases: where one file has data at 5:30:01 and the other doesn't?
I presume you need to time-align the data.
If that is correct, then
Open both files
Skip header line(s)
Create Result file.
repeat
Read line from HOBO
Convert column 0 to TIMESTAMP (Th)
Read line from RBR
Convert column 0 to TIMESTAMP (Tr)
Repeat
If Th < Tr
Read Line from HOBO
Convert column 0 to TIMESTAMP (Th)
if Th > Tr
Read line from RBR
Convert column 0 to TIMESTAMP (Tr)
until (Th = Tr) or EOF
if not EOF
Extract Columns from HOBO and RBR lines
Format new RESULT line
end
until EOF
That will skip unmatched lines (in your example, that would be 5:30:01 to 5:30:06)
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-11-2022 03:48 PM
08-12-2022 01:43 AM - edited 08-12-2022 01:45 AM
Hi guys,
Thanks for your quick answer.
I will look at your solution as soon as possible.
I know my code is very well constructed but I am a beginner with Labview (2 years).
I will let you know when I will succeed.
Adrien
08-22-2022 09:01 AM
Hi Raphael,
I would like to thank you. I upgrade the code that ou sent to me, to match with my need and it's work very well.
I will try for my next code to make them more cleaner.
Best regards,
Adrien