LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to count bit patterns in a file ?

Hi Hans

 

Sun was actually shining this weekend so I spent my time outside, didn't see your questions until now, but it looks like you have things well in hand. Is there anyhting that is still unclear?

 

Best Regards

David

0 Kudos
Message 11 of 13
(551 Views)

Not only for the fun but also because I was pretty sure that you don't need all those loops, here's my version.

One loop to determine the consecutive 1's in the XOR array and

One loop to group the result in "Run" and "Run length", no more no less Smiley Wink

You can use the "TestArray" to simulate some combinations... ...

 

Like already suggested previously, I read the file at once.

Also I don't see the need to process data in blocks, that complicates the task unnecessarily. You have to keep track of 1's at end and start of blocks!

 

Another concern that I had was; "Should consecutive 1's be delimitted by a 0 or not?"

I think yes, so I wrote the code that way.

If the array end's with two 1's, is that a run length of 2? Can be but it's not sure since you don't know the following bits.

So I prefer to drop inaccurate data than keep it Smiley Surprised

0 Kudos
Message 12 of 13
(539 Views)

For your problem, you could apply "Convolution"

 

It's a math function, the base for FFT, spectrum etc.

The output signal is the likeness of both samples, in function of time or delay.

 

It's often applied for determining echo delay, where the original and reflected signal are compared to eatch other.

0 Kudos
Message 13 of 13
(529 Views)