08-08-2009 12:37 PM
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
08-08-2009 02:58 PM