LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add an array elements in a for loop

 
I wanna aquire signal data several times so that I can reduce the noise by adding them together. Now the questions is I can not add the data of the previous loop with that of the loop, see the following vi in the attached file. Thanks.
0 Kudos
Message 1 of 4
(2,596 Views)

Since you don't initialize the shift register, the array has initially zero elements. Adding an array of any size to it will result in an array of zero elements as expected.

Possible Solutions:

  • Use a case structure wired to [i], and
    • if [i]=0, wire the array directly to the shift register
    • in the default case use the add operation.
  • Initialize the shift register with a correctly sized array of zeroes.
  • ...
0 Kudos
Message 2 of 4
(2,593 Views)
Here's a picture of one possibility:
Only if the loop time is very slow and you want to see imtermediary results, you should place the indicator after the switch. Otherwise if should be after the loop as shown.


Message Edited by altenbach on 03-07-2008 04:27 PM
0 Kudos
Message 3 of 4
(2,589 Views)
Thanks. It is a great help.
0 Kudos
Message 4 of 4
(2,552 Views)