LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create Digital Array?

Hey everyone,

 

Right now, I am trying to create a digital array several thousand samples long full of 0's - I am planning to write over them with 1's at specific points so that I can create a digital waveform.

 

Is there any function or set VI on labview that I can use to create a digital array?

 

Thanks a lot,

Mitchell

0 Kudos
Message 1 of 23
(3,709 Views)

What do you mean by digital? Do you simply mean that your values will consist of only 0s and 1s. LabVIEW does not have a bit array. You can create an array of Boolean values or a byte array. The Boolean array would be the closest to a bit array though internally each element will be an 16-bit value.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 23
(3,705 Views)

Use "initialize Array" from the array palette:

Message 3 of 23
(3,704 Views)

Sorry about that - yes, I do mean that the array should only consist of 0's and 1's - if I used initialize array, connect it to a number representing my samples, and connect it to a false boolean would that mean everything would start at 0 value? 

0 Kudos
Message 4 of 23
(3,695 Views)

There is only EITHER Boolean or Numeric to choose from. As Mark Yedinak said - using 8Bit Numeric will save you 50% of memory as Booleans are represented by 16 bits of data. In case you want to write the digital waveform to a DAQmx device - this works with U8 arrays. So you best use that.

0 Kudos
Message 5 of 23
(3,682 Views)

Yes, initialize array can take a Boolean as it's element data. You could also use an 8-bit number as your data type.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 23
(3,679 Views)

...as could be seen in the above attached picture of my first post:

http://forums.ni.com/ni/attachments/ni/170/689250/1/InitializeArray.PNG

0 Kudos
Message 7 of 23
(3,675 Views)

Hi to all,

 

booleans are still stored internally as bytes - or did that change with LV2012?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 23
(3,672 Views)

not quite sure what you want, but you need a U16 to represent your several thousands value(65,536)...a U8 only represents a 255 value

Example_VI.png

0 Kudos
Message 9 of 23
(3,664 Views)

Hi apok,

 

both Mark and comrade wrote "booleans are stored as 16bit values", which is wrong.

 

It's not about converting U16 to boolean arrays, it's only about how LabVIEW internally stores boolean values...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 23
(3,649 Views)