From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert into array does nothing

Solved!
Go to solution

Hello,

 

I'm trying to make a function which takes an initialized array of some size, and within a while loop, creates an array such that

 

array[i] = total time elapsed,

 

where i is the current loop iteration. According to numeric indicators, the behaviour of elapsed time and iterations is correct, but nothing is ever inserted into the array. All elements are still 0. What might be wrong? I've attached my code below.

Download All
0 Kudos
Message 1 of 3
(1,970 Views)
Solution
Accepted by Ccx55

It's getting inserted into the array.  The problem is that on the next iteration of the loop, you act on the original initialized array and the actions from your previous loop iteration were discarded.  Only the last iteration of the while loop outputs the last value you inserted.

 

You need shift registers on those array tunnels so the results of the first loop iteration are "shifted" to the beginning of the loop and available for the next loop iteration.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 2 of 3
(1,964 Views)

Wow, that was incredibly quick. It works as expected now, thank you! I'll take a look at those links as well.

0 Kudos
Message 3 of 3
(1,957 Views)