LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare two files bit by bit ?

I asked this question already under another title.

But lets try again.

 

Think of the following: You have two files that you want to compare bit by bit.

A file has been send the other one has been received.

The two files can be of different size (Connection lost).

But you not only want to know how many bits are different you want also to know the run length of the different bits.

For example:

File 1: 1010101011101010111101011001

File 2: 1011101010001101010111010101

What is the result ?

Xor File1 and File2: 0001000001100111101010001100

Run Length 1: 3

Run Length 2: 2

Run Length 3: 0

Run Length 4: 1

I hope I didn't make a mistake.

 

Think also of using a blocksize for comparison. Maybe you don't want to compare the files as a whole but want to know the number of errors for every block that is maybe 256 bit or 1024 bit. So read the files block by block, xor the blocks and count the bit errors by their run length.

 

What does the VI ?

 

It reads from two files a block as integers.

Every integer of 8 bits is converted to an array of boolean.

The 8 booleans from the first file are xored with the 8 booleans from the second file.

The xored bits are concatenated to an array of boolean.

It then searches first for a 1 and then for a 0.

The positions (Both on top of the Panel) are subtracted and the result is taken as an index.

An array of clusters is generated.

Each cluster consists of the index (The run length) and the number how often this run length was recognized.

The array is searched for a given run length if this has been already counted.

If yes the number is incremented by one, if no a new cluster is generated and added to the array.

 

Where are the problems ?

 

The reading of the files. Does the path exist ? Is the file not empty ? (Error Handling)

The reading of more than one block from the files. Initialization problem in the first part of the sequence.

Simpification. Can I erase something ?

 

 

Thanx for help and your time

0 Kudos
Message 1 of 2
(5,430 Views)
I would help with the LV, but I am stuck with v8.2.  My best advice then is to not irritate those most able to help by repeating questions in multiple threads.  Remember that we are all volunteers here, and that even though this is a community of hard-core LV users, many of us have lives and may not be prowling the boards on weekends.  If you feel that your original thread is getting buried and neglected, feel free to post a progress update to the original thread with what you have been trying, and this will float it to the top.  If you (1) ask specific questions (2) post code and (3) show evidence that you are actively struggling with the problem and not sitting around waiting for someone to solve it for you, I have no doubt you will receive the help you are seeking.  
0 Kudos
Message 2 of 2
(5,413 Views)