LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read bits from the file?

Solved!
Go to solution

Hello everybody,

 

I'm beginner in LabVIEW. I need to get bits from the file, but I don't know how I can do it. I use the example "Read Binary File VI" from LabVIEW Help, but it returns DBL array. And for a long time I can't find a solution to convert this array to array of bits. Cat Sad  Can somebody help me? Thanks in advance. 

0 Kudos
Message 1 of 4
(2,852 Views)
Solution
Accepted by topic author tranonim

This is a very vague question. A file is nothing more than a long string of bits, so you could simply read it as a string and parse out the bits the way you want them. I don't know how you want them 🙂

 

One possibility would be to cast to an array of U8, then use "number to boolean array" in an autoindexing FOR loop, followed by reshaping to a 1D boolean array. You could also format the U8 as %08b and concatenate the strings. There is no "official" way to represent "bits" to the human observer. 😉

Message 2 of 4
(2,836 Views)

@tranonim wrote:

Hello everybody,

 

I'm beginner in LabVIEW. I need to get bits from the file, but I don't know how I can do it. I use the example "Read Binary File VI" from LabVIEW Help, but it returns DBL array. And for a long time I can't find a solution to convert this array to array of bits. Cat Sad  Can somebody help me? Thanks in advance. 


You can pass in the type into the Read Binary File VI to get the data in whatever form you want.  Just remember that a boolean is really 8 bits.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(2,829 Views)

Thanks guys! Special for 

0 Kudos
Message 4 of 4
(2,795 Views)