LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to maintain counter in a for loop

Solved!
Go to solution

Hi, 

  How do we track counter in a loop?Isn't it the way I implemented.? Please suggest.

 

Regards.

0 Kudos
Message 1 of 5
(2,449 Views)

You can accumulate the running sum in a scalar initialized shift regsiter. No need to build a large array just to sum it at the end.

Message 2 of 5
(2,441 Views)
Solution
Accepted by montu.dada

thankx,

I am not familiar about such register ,its been a while since I started Labview.So this circuit is not optimized but should work? 

 

regards

0 Kudos
Message 3 of 5
(2,436 Views)

If you aren't familiar with shift registers, then I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

It might work in practice, but it would be nominated for the Rube Goldberg thread.

 

Is your question solved?  If so, you should mark Altenbach's message as the solution to your question.  If not, then you cerainly shouldn't mark your message as the solution.  First you will need to go to the Options menu to the upper right of your "solved" message and unmark it as the solution.

0 Kudos
Message 4 of 5
(2,414 Views)

Both loops have errors, if you try to do for(i=60;i<120;i++) you're only running 60 loops, not 120. 🙂

You should also disable the autoindexing on incoming arrays as you want some split array indexes (actually you can optimize it by extracting the constant a[30] before the 1st loop and the opposite on the 2nd. Now you're extracting 2 numbers from a 1D array instead of 1 from a 2D array ...

The number on the select/sum function should be integers, no need to calculate doubles.

The small array to sum it up is only max 170 numbers, it's ok although a sum in a shift register would be better.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(2,389 Views)