LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i compare to text files and display the differences?

Hi,
 
I've searched a lot of posts that are close to this, but i still find myself needed some help.  I have to large text files that are used for testing data.  When i run the test i know the data that is supposed to come out so i have a checksum file that i want to compare my new data with.  This can be a rather large text file but not huge.  How do i compare the two files and display what was different between the files (if any) and where the differences were located.  I've attached the closest that i came up with but as you can see if the files were huge then you wouldn't be able to see the differences on the front panal unless you scrolled the arrays for a longgggggg ways. 
 
and yes this has to be done with labview...can't just do a normal diff
 
regards
0 Kudos
Message 1 of 8
(5,244 Views)
The file Open_Read_Binary_File.vi is missing.
 
Is the content of the file binary data?  Or when you mention comparing two files, do you mean the ASCII text? 
I'm asking because the output of the missing VI is binary..   (actually you may be in the right direction...)
 
I may have something useful...  I will look for it or prepare a small vi..
 
 
 
 
0 Kudos
Message 2 of 8
(5,238 Views)
Hi,
 
All the Open_Read_Binary_File does is open a text file then converts it to a binary array.  The only reason i did this is becasue this was all i could figure out to help me acheive my goal.   I attached the Open_Read_Binary_File just in case you still just want to see it.   It still might be possible to use this and then convert it back to something that would make a more easliy readable display on the front panal, but i don't know how to do that.
 
thanks for all the help
 
 
0 Kudos
Message 3 of 8
(5,222 Views)
Will your project allow LabVIEW to call another program?
 
 
you can use the system exec vi to call examdiff with the two files as command line parameters

Message Edited by James R on 08-14-2007 11:20 AM

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 4 of 8
(5,212 Views)
Actually I can't call another program unless it's something part of the NI suite.  The programs are on a testing console, and I wouldn't get approved to add any programs that were only going to be used for one situation.  Even if it's free, Its such a hassle to add it to the system.
0 Kudos
Message 5 of 8
(5,206 Views)

one word of caution when comparing files.  LabVIEW does not process strings too efficiently.  When doing comparisions try converting the text to hex and compare the numbers rather than the strings. 

if you just want to see if there is a difference there are .md5 VIs in the openg toolkit

http://openg.org/tiki/tiki-index.php?page=OpenG%20Toolkit

 

 

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 6 of 8
(5,203 Views)
I found something cheaper than ExamDiff Pro.
diff.exe installs as part of vim.
 
Here's a typical example call (a LabVIEW string passed to the builtin function "System Exec"):
C:\Program Files\Vim\vim63\diff.exe -iwbBy  --suppress-common-lines "Z:\projects\restores\1199455\BCM8020\software\T6\system\deskew_test\deskew\enable_link_win_30.txt" "V:\BCM8020\software\T6\system\deskew_test\deskew\enable_link_win_30.txt"
 
I love vim so much, because it makes text-based languages so easy to program in, that it nearly pulls me away from being a hardcore LabVIEW user!  (Too bad most text-based language development environments aren't as nice as LabVIEW.)
Message 7 of 8
(5,074 Views)
Hi,
Could you post the file that you are trying to read in and compare? What roadblocks are you having right now?  If you know how the file is formatted then you should be able to use the read from text file and write to text file examples to build your own VI to compare two text files.
Eric A.
National Instruments
Distributed I/O Product Support Engineer
0 Kudos
Message 8 of 8
(5,006 Views)