LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing data

Hello guys,

 

I really stuck finding a solution for my application. I uploaded it as a 7z file.

I have no problem when I got only text files with only "T200"  in my folder REF_ and not REF, but I want to make it work when I put different REF files and other files like T600 and 900. My calculations are always done with only one REF file. I want to make it compact.

Example:
I have 3,4,5, etc.. REF_ files with different T200 / T600 / T100 / T-100 etc. to be calculated with the not ref files T200 / T600 / T100 / T-100 etc.

My app is calculating it all by 1 REF file. 

Sorry If I do not explain it very well. 

Thanks for all help in advance! 🙂

0 Kudos
Message 1 of 6
(2,642 Views)

You should attach your files as a .zip file, not .7z.  Not everyone wants to download a separate zip program when there is a perfectly good one built into Windows.

0 Kudos
Message 2 of 6
(2,632 Views)

Sorry for that, I think 7zip is also by default uploaded it again. 

0 Kudos
Message 3 of 6
(2,626 Views)

Thank you for uploading your files.  I'm still unsure what you want to do.  I was going to write that you should include a data folder, but I see that you did (thanks!) ...

 

I took the liberty of making a few changes in your Regxp VI.  The main change I made was to (manually) "compact" it by removing excessive White Space so that the entire VI can fit on a laptop screen.  I also used the "Conditional Indexing" feature of Array Indexing (output) Tunnels introduced 5-8 years ago (I think), which makes the initial code switching the strings into those that don't and do start with "REF_" very simple.  Here it is:

BS version of RegxpBS version of Regxp

The code at the beginning says "There's a folder called "Data" in the same folder as the current VI -- use this as the Data Folder".  The first For loop uses two Conditional Indexing tunnels -- the input is added to the Array if the conditional terminal is True, so I use the Test to directly put the String in the top Array (if it doesn't have REF_) or the bottom (if it does).  Question -- what will it do if the File is named "100REF_200"?   Your test might not be quite right ...

 

Keeping things compact makes it easier to read and to understand.

Bob Schor

0 Kudos
Message 4 of 6
(2,611 Views)

Hi BS,

Thanks that is a nice solution.

I'm averaging data ( 4th and 5th column last 10 rows)  from  the 4 REF_ files then do an average again for the 4 of them

and subtract it from data from not ref files. 

Its okay if I got only 4 REF files.

Example:
I have REF_19049000000001#1_1_T200 ; REF_19049000000001#1_2_T200 ; REF_19049000000001#1_3_T200 ; REF_19049000000001#1_4_T200

 

I have REF_19049000000001#1_1_T400 ; REF_19049000000001#1_2_T400 ; REF_19049000000001#1_3_T400 ; REF_19049000000001#1_4_T400


I can have other REF's too they are founded by numbers after T

And i want to subtract the data them from the non REF files.
19049000000010#1_T200

19049000000010#2_T200

19049000000010#3_T200

19049000000010#4_T200

19049000000010#1_T600

19049000000010#2_T600

19049000000010#3_T600

19049000000010#4_T600

and many many more 

 

Its okay when its only T200 in the folder, but if I add other non REF and REF files with T600 etc.. the calculations are made only from 1 ref file.
Hope its clear enough now. 

Thanks !

0 Kudos
Message 5 of 6
(2,607 Views)

Well, it's not clearer to me, but that might not matter (if it is clear to you).  The output of my Regxp code on your Data file shows 12 different files that start with REF (Golden Sample).  Note that the T200 files have one less "0" in the first field (190490000...1) than the other REF files -- presumably this is OK.

 

I didn't check, but presume all 12 REF files are different (it's not difficult to check this -- you might want to consider it).  Am I correct that you want to run through your "S" files 12 times, each time applying an appropriate Reference File?

 

If so, you can do this with a doubly-nested For Loop.  With the outer For Loop, bring GS in on an Indexing Tunnel and S in on an "ordinary" tunnel (when you bring it into the For, it will make an Indexing tunnel, but you can right-click it and turn off indexing).  Now the inside of the Outer For has one REF and all of the S data.  Bring both into the Inner For Loop -- GS will automatically be an ordinary Tunnel and S will be an indexing tunnel, so inside, you have two things to compare, GS and S.  If GS is appropriate for the S file, process it, and if not, ignore it.  Each S should be matched by at most 1 GS (that's why you want to check that all the GS's are unique).  Note when you go through the inner For, you should also check that at least one GS matches, i.e. that you don't have any S files without a corresponding Ref.

 

Oops -- I did this backwards!  Since the GS file is much smaller than the S file, it would be better to index the outer loop on S (and bring GS in on an ordinary Tunnel) and the inner loop on GS.  I realized this mistake when I wrote the last sentence of the previous paragraph (which is much easier to do with GS varying in the inner loop).

 

I know this sounds confusing, but I'm sure if you start taking these Arrays and bringing them into For Loops, it will be obvious (and almost trivial) for you as you understand the data, the file names, and what you want to do.

 

Good luck with your project.

 

Bob Schor

0 Kudos
Message 6 of 6
(2,595 Views)