LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not Enough Memory with my array


ds_1 wrote:

Hi altenbach,

                     Thanks for the suggestions, the data can be either 12,14,16,18 24 or 30 bit so the lookup table may get a little complicated to implement, particulatrly in the case of the 30bit where it is a middle 7 bits only that i need to reverse, but I think I may need to try it out!               


For the 30 bits, you would represent your data as U32. To reverse the inner 7 bits, you can split/join it while processing an 8bit part via a lookup table. Do the 7 bits cross byte boundaries?

0 Kudos
Message 11 of 15
(708 Views)
Thanks again, another avenue I can persue, 16bits (in some cases) could be split off as its the other 14 I've rearrange and process. My main problem at the moment is getting the time to update my code as this would be down-time at the moment..I'm just currently running gathering smaller numbers of samples (which isn't ideal for the application). I guess my biggest mistake was assuming that boolean, would be the most compact form of data handled by labview. I assumed each 1 and 0 would take a single bit of memory, but from earlier in this post it appears each takes a byte? Or am I missing the point?
0 Kudos
Message 12 of 15
(680 Views)

Hi ds,

 

you're right, each bit is stored internally by in one byte. This makes boolean arrays use 8 times more memory than usually is needed Smiley Sad, but makes them compatible with other array types in LabView.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 15
(675 Views)

Hi ds_1

Boolean vales are stored as 8 bit or a byte. The reason for this is how the computer memory is organized. The smallest unit you can point to (or adress) in your computer memory is a byte. So all Booleans are stored as a byte. If you are interested in how Labview store data in memory you may take a look at this

http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/how_labview_stores_data_in_memory/

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 14 of 15
(668 Views)

ds_1 wrote:
I assumed each 1 and 0 would take a single bit of memory, but from earlier in this post it appears each takes a byte? Or am I missing the point?

Historically, you are not completely wrong. Back in LabVIEW 4.x, arrays of booleans were stored as 8 elements/byte and certain functions (e.g. typecast) still have legacy modes to deal with 4.x flattened boolean array data, for example. 😉

 

In virtually all cases, you can do all you need purely in blue. Boolean operations perform bitwise on integers.

 

For some illustrative examples on how to avoid boolean arrays, have a look at the results of the bit twiddling challenge from many years ago (2002). The green solutions took up to 14 seconds while some blue solutions did the same work in under 100ms. (..and today's computers would probably be another 10x faster)

0 Kudos
Message 15 of 15
(644 Views)