LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean array to tdm

hi,

is there a opportunity to write a boolean array to a tdm file?

I have digital inputs and want to write them 1:1 in a tdm file without
overhead. By default I can only write single boolean values with the Write
Data Function. But I think that the signal type is although an integer or
double.

Has anybody a good suggestion for my problem?

Best Regards

--
Joachim


0 Kudos
Message 1 of 4
(3,205 Views)
Joachim,
 
Before you can wire a boolean array to the Write Data.vi, you must first convert the boolean array to dynamic data by using the Convert to Dynamic Data.vi located on the Functions>>Express>>Signal Manipulation palette. In the configuration dialog for this conversion function, you need to select "1D array of scalars - single channel" as your "Input data type" and "Boolean" as your "Scalar Data Type".
 
Kind Regards,
E. Sulzer
Applications Engineer
National Instruments
Message 2 of 4
(3,191 Views)
Hi,

Thanks for your reply. I am already using the "Convert to Dynamic Datatype" function. The problem which I have is that when I write a total of 80000 booleans this results in a filesize of 625 kilobytes. This means that the single 1-Bit Boolean Datatype is converted to a 64Bit Datatype. In my case that would mean an overhead which is
unacceptable because of the needed storage when I log 16 digital channels round the clock.

Do I have a chance to save storage?

Thanks in advance.

Kind Regards,

Joachim
0 Kudos
Message 3 of 4
(3,174 Views)

Booleans in LabVIEW are stored as bytes (8 bits) in memory. Doing the math using the numbers you provided, it sounds like everything is working properly. You are obviously correct that byte storage is not the most efficient way to store Boolean numbers, and if memory efficiency is important in your application, you can group together and convert your Booleans into integer numbers so that they can be stored as single bits in memory. You can do this by grouping your Booleans into 32-element arrays and by using the Boolean Array to Number.vi to convert those arrays into 32-bit integers. You can then write these integers to a binary file in which your Boolean values will be represented as single bits. Note that, when reading the file back, you will need to reverse the conversion.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
Message 4 of 4
(3,156 Views)