05-15-2013 01:02 PM
I’m new in LabVIEW and have searched for any examples of what I’m trying to accomplish with no luck and I seriously need some help!! How do I read 2 CSV files line by line match/compare and if no match flag and display error with location of the error? My files have over 1000 lines. I have attached a flow chart to reflect what I’m trying to achieve.
Solved! Go to Solution.
05-15-2013 01:14 PM
Read both files simultaneously in a loop a line at a time. Compare the strings. If they are not equal, stop the loop, display the strings. By reading the i terminal of the loop, you'll know which line of the file it stopped at.
05-15-2013 01:43 PM
05-15-2013 04:17 PM - edited 05-15-2013 04:18 PM
@apok wrote:
compare the 2 arrays in a for loop and build an array for the location...
You don't even need the FOR loop. Do the comparison on the arrays of lines and perform a Search 1D Array on the boolean for a False (assuming using Equal). It will return the index of the first line that was different and a -1 if they lines were the same.
05-16-2013 11:48 AM
None of the above post works. Maybe misunderstood. The idea is to read each line from the file and compare to a corresponding line (known results) and if they match flag a pass/fail. Need to do this sequencially my files have strings stored in a 1D array as csv file. Any help is really appreciated and thank you.
Like
file1 | file2 | results | ||
This is a stop sign | This is a stop sign | pass | ||
Cross walk | stop | Fail |
05-16-2013 11:50 AM
Attach your VI and your example files.
I'm sure it will work. It must be something in your implementation.
05-16-2013 12:19 PM
05-16-2013 12:34 PM
That is a screenshot, not a VI.
So what is wrong with what is attached?
It looks like you have the array broken up into words rather than lines. In which case the problem is where you read in the data file and created an array out of that.
Since you didn't attach a VI that shows that part of your operation, I can't comment on that.
05-16-2013 01:46 PM
@RavensFan wrote:
That is a screenshot, not a VI.
So what is wrong with what is attached?
It looks like you have the array broken up into words rather than lines. In which case the problem is where you read in the data file and created an array out of that.
Since you didn't attach a VI that shows that part of your operation, I can't comment on that.
Ravens: Different posters.
OP: APOK has the solution right there for you.
05-16-2013 02:24 PM
crossrulz wrote:Ravens: Different posters.OP: APOK has the solution right there for you.
You're right! I must have merged a couple of posts together in my mind when I read them.
But the part about an array of words vs.an array of lines still applies.