LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read 2 CSV files of line by line match/compare and if no match flag and display error with location of error?

Solved!
Go to solution

Thanks for your help. However I was wondering how I can also read rows from the files while keeping the column constant. Like read 0,1,2,3,4,...rows while column stays the same.

0 Kudos
Message 11 of 20
(847 Views)

What colums?  I thought you had a 1D array of strings.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 20
(844 Views)

Made 2D to seach for a specific word in the output to flag a match in case I change the order of the input commands. I'm wondering how do I increament the rows and keep reading from the same column

Download All
0 Kudos
Message 13 of 20
(836 Views)

You could index by the colum and then process the data in a FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 20
(834 Views)

Tried indexing by column and process the data in a for loop but doesn't work. Maybe a sample MOD of my VI as to what you mean could help?

0 Kudos
Message 15 of 20
(815 Views)

Something like this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 16 of 20
(811 Views)

Thanks for the help. Did it a different way but same idea. However if I was doing real time data output how do I index the matching to the next line from the output?

0 Kudos
Message 17 of 20
(798 Views)

I'm not quite sure what you mean by that. Could you post the VI you ended up using and explain in a bit more detail what you're asking?

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 18 of 20
(775 Views)

Apologies for not giving good clarification. I'm running "live' test on a device by sending commands get the output from the device search for a key word in the output and flag a pass/fail  in real time need to do this on every command. My problem is I have to wait for the device to loop through all the commands and output result before I can search strings on the output for match and flag a pass/fail. Would like to check the result in real time. A manual check would be like send a command check  the screen it that the right result yes/no next command (Automating this is the problem)

Download All
0 Kudos
Message 19 of 20
(758 Views)

I do not understand what your VI is trying to do. 

 

You take all the strings from the 2D array constant and concatenate them into one long string:

"DIS CONFIGURATION UPDATE

All changes to the configuration will be saved

savedDIS CRC

CRC mode is disbled

modeDIS DELIMITER

Tab separated output 

Tab".

 

Then you concatenate the strings from the columns in the text file separately into two strings which look nothing like the 2D string:

"DIS CONFIGURATION UPDATEDIS CRCDIS DELIMITER"

and 

"savedmodeoutput"

So, the Match Patterns never find a match.

 

None of the input data ever changes inside your for loop.  This for loop will produce the same result and will certainly execute much faster for large strings.

 

same result.png

 

String matching can be slow.  If you can focus on the part which is the key to the match, you may be able to speed things up.  Which column has the "Commands"? Are the reference values (list of commnds) in the file or is the array constant in the VI the list of commands and the file represents your "live" data?  Building an array inside a loop can be very slow because it requires frequent memory re-allocations as the array grows. Either post-process the Pass/Fail array to get the line numbers or Initialize Array outside the loop to the maximum size and use Replace Array Subset inside the loop.

 

Lynn

 

0 Kudos
Message 20 of 20
(745 Views)