LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a stored array element

Hello,
 
I want to use  a single element seqentially starting from Index zero in an array(1D) and use that element. How can I choose one element each time from that array and use it.?
 
Thanks
Ravi
0 Kudos
Message 1 of 14
(3,714 Views)

Assuming you use a FOR loop, it is sufficient to autoindex into the loop and you'll get one element per iteration (starting with element zero) until you run out of elements, at which time the FOR loop ends.

For more complicated needs, just use "index array" and wire the index to simething that increments at the desired rate (e.g. the [i] terminal of a loop).

0 Kudos
Message 2 of 14
(3,707 Views)

Thanks altenbach,

Does that mean that i just connect the autoindexed point on the for loop where I can output the elements to my further string in which each element will be automatically formatted into the string.

If the first element outof the forloop is say 1.0, i connect it to a format string input CURR%f, its first output will be CURR1.0 and so on as the for loop iterates. have I interpreted it right?

Sorry if  I sound too clumsy.

Ravi

0 Kudos
Message 3 of 14
(3,702 Views)
Yes, like everything is LabVIEW, it's that simple!
 
 
 
You don't need to wire N, etc.

Message Edited by altenbach on 09-17-2007 10:33 AM

Message 4 of 14
(3,698 Views)

Thanks, I could get it. Also could you specify, if a for loop takes each element from the array by tunneling , then can it also output the array which is autoindexed. like we collect bunch of elements in an array in a for loop,can we tunnel them out one element at a time?

This will help immensely.

Thanks again

Ravi

0 Kudos
Message 5 of 14
(3,688 Views)
Yes, an autoindex output tunnel will create an array of size N, one element per iteration.
0 Kudos
Message 6 of 14
(3,683 Views)

Yes, using indexing on the input and output allows you to feed an array in one element at a time and collect the elements at the output into an array that will be passed out when the loop completes.

 

Jim

Jim

LV 2020
0 Kudos
Message 7 of 14
(3,680 Views)

Thanks a bunch that solves my one problem.

Thanks again.

Ravi

0 Kudos
Message 8 of 14
(3,676 Views)

But I have a little prob. here. When I run this VI, it works fine for the first time but second time I run it, it hold the previous value and starts incremtning on that. The problem to me seems in the for loop where I pass into format into a string.

I want that to be always zero intially and then pass on the value which ever comes from the user.

Thanks

Ravi

0 Kudos
Message 9 of 14
(3,672 Views)
You need to initialize your shift register (feedback node). Connect a zero to the left terminal (with the diamond) outside the loop.

Lynn
Message 10 of 14
(3,667 Views)