LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save a bit sequence to file?

Solved!
Go to solution

Hello Reader.

 

The demodulation's output is a bit sequence and I'd like to save it to file. When I connect the demodulation's output to the data port of "write to binary file" block, a bit is converted to a byte automatically and write to file (so file's size too large.)

 

Could you help me to write the bit sequence to binary file, please?

 

Thanks so much.

 

TanPhong.

0 Kudos
Message 1 of 7
(2,620 Views)

What is the datatype of your "bit sequence"? A boolean array maybe?

 

If this is the case, typecast it to a string using the 4.x mode of typecast before writing the string to a file. Reverse the operations for reading. (you might also need to account for padding)

0 Kudos
Message 2 of 7
(2,619 Views)

Thanks for your attention.

 

I've followed your advice but the data in file is similar with the old data (one bit to one byte)

0 Kudos
Message 3 of 7
(2,615 Views)

Did you right-click the typecast primitive and select 4.x mode (it will show big red lettering)?

 

There should be one bit per boolean element. If it does not, show us your code.

0 Kudos
Message 4 of 7
(2,608 Views)

I used Modulation example and add some functions to save outbit data after demodulation to file.

0 Kudos
Message 5 of 7
(2,601 Views)
Solution
Accepted by topic author phonglt03

OK, your data is a I8 array, where 4.x mode has no special meaning. What kind of data is in the I8 array? Is it just numbers 0 and 1? In this case, insert a "not equal 0" to convert it into a boolean array before type casting.

 

(Sorry, I don't have any of your toolkits)

0 Kudos
Message 6 of 7
(2,596 Views)

Thank you very much.

0 Kudos
Message 7 of 7
(2,588 Views)