# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## Continuous reading of array elements

Hello everyone,

i am pretty new to Labview and i am trying to do some tasks. I found some difficulty to continously read elements from an array. For example, if we have an array with 10, 15, 20, 25, 30, 35, 40 i would like to read each value sequentially, 10 then 15 then 20 etc. I know it has to do something with For loop and Index Array but I can't make it work. Any ideas?

Message 1 of 8
(239 Views)
Solution
05-19-2017 12:45 AM

## Re: Continuous reading of array elements

What should happen in you run out of elements?

All you need is auto-indexing on a FOR loop and placing a numeric indicator inside the loop. Since this will complete in nanoseconds, you also want to place a small wait inside the FOR loop.

Message 2 of 8
(218 Views)
Solution
05-19-2017 12:44 AM

## Re: Continuous reading of array elements

/Y

"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Message 3 of 8
(181 Views)

## Re: Continuous reading of array elements

After the elements finish, just to stop. Nothing special.

Message 4 of 8
(175 Views)

## Re: Continuous reading of array elements

Hello again, please take a look at my photo. I create an array of 10 elements (read from txt) then i want to take each of them and sequentialy. When i run it, it works fine but the only thing i see to my "subarray" indicator is number 10 which is the first element of the array. (the array contains this values (10, 15, 25, 35, 45, 55, 65, 75, 85, 95). Any ideas?

Message 5 of 8
(130 Views)

## Re: Continuous reading of array elements

Why are you using "built array" to turn your 1D array into a 2D array? Don't!

All you need is Yamaeda's code above, don't over-complicate things!

(Explanation of what you are seeing: Your 2D array has only one row, and since you are autoindexing, the FOR loop only iterates once, no matter what you wire to N. The shortest autoindexing array always wins! Also, next time please simply attach your VI. Oversized images are pointless)

Message 6 of 8
(110 Views)

## Re: Continuous reading of array elements

Ok thanks a lot, i managed to make this. Now, what i would like to do is from this array, take an element, pass it as a setpoint to PID (not finished) do a control loop with this setpoint and after that, change the setpoint with the next element from the array. If element1=10, then setpoint=10, do control loop then element2=20, setpoint=20 etc.

Message 7 of 8
(101 Views)

## Re: Continuous reading of array elements

Do a state machine. Look at the templates and examples that ship with LabVIEW.

Message 8 of 8
(98 Views)