NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

Binary File to Boolean Array

VERSION 2

Created on: Mar 18, 2009 11:20 PM by BurtS - Last Modified:  Sep 12, 2009 8:01 AM by BurtS

Functional Description

This example reads from a binary file and converts the information into a single one-dimensional boolean array.

 

Caveats and Additional Notes

The example assumes that no header information was written to the binary file.  This example is most useful when the information saved to the binary file was originally in a one-dimensional boolean array format.  The example is best used in conjunction with the Boolean Array to Binary File example found here. Note that if the original boolean array has a number of elements that is not divisible by 8, then this VI will output an array with more elements than the original array contained.  This is caused by the fact that binary files can only be addressed by bytes.

 

Binary File to Boolean Array 2.PNG

 

Downloads:
Average User Rating
(1 rating)




Christian Altenbach Christian Altenbach  says:

Also here we can simplify. Remember that growing large arrays at every iteration of a loop can become very expensive, because each resize operation requires a new memory allocation. It would be much easier to do as follows:

Since we now have autoindexing, the final array size will be fully allocated once at the start of the FOR loop and things can proceed "in place" for the duration of the loop. For large arrays (and they probably are, why else would you compress the data?), this could be orders of magnitude more efficient.

BurtS BurtS  says in response to Christian Altenbach:

Thanks again for the input.  I have changed this example as well.

More Like This

  • Retrieving data ...