LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sequentially adding elements to an array

Hello again,

 

I'm trying to write a simple VI that uses a FOR loop to calculate a series of data points sequentially and passes them to a 1D array where they will be stored and retrieved later, however I'm having trouble doing this, my VI seems to calculate the values sequentially, but then overwrites each one into the first element in the array rather than the next one

 

can anyone suggest a simple way to do this? I'm finding the examples next to useless... surely this should be a basic fundamental operation? or am I misunderstanding how arrays are used in labview?

 

pic of my code attached

0 Kudos
Message 1 of 3
(2,998 Views)

Hi Sholyoake,

 

but then overwrites each one into the first element in the array rather than the next one

Because you have programmed it that way: using a BuildArray node with just one input! This creates an array containing just one element…

 

a simple way to do this?

Move the array indicator outside the loop and use autoindexing to create the array…

 

I misunderstanding how arrays are used in labview?

Well, you misunderstand basic DATAFLOW…

Best regards,
GerdW


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

thanks for the reply, sorted it out now 🙂

0 Kudos
Message 3 of 3
(2,911 Views)