09-25-2019 03:30 AM
Hello gents, probably this question has been asked before, I already read the discussion here:
https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Smart-Iterators-with-Loops/idi-p/967321#comments
but i didn't understand it quite well.
My question is: how can i start a loop from a certain index given an array?
For example, suppose i have an array of 3000 elements and i want to start the loop from the element number 1670 till the final element and put a stop condition on the loop if a certain requirement is fulfilled. How could i do this?
Thanks in advance for any answer or help.
Solved! Go to Solution.
09-25-2019 03:53 AM
Don't use autoindexing. Get each array element with an Index Array node. As an index, wire the sum of the loop index and your offset (1669 in your example, assuming you mean the 1670th element).
09-25-2019 04:34 AM
Sorry, but it is still not very clear to me (i'm new to Labview).
Could you attach a picture or a simple VI with a random created array as an example?
09-25-2019 04:49 AM
This is a very trivial example: I'm simply extracting a sub-array from the original data, starting from a given index (you would normally use Array Subset to do this!).
To avoid autoindexing, I right-clicked on the Loop tunnel (where the source array enters the loop) and un-checked Enable Indexing.
09-25-2019 03:39 PM
09-26-2019 02:57 AM
Thank you both pincpanter and Yamaeda i can use this method to solve my problem, so i am basically forced to build a subarray to do this right? And then i should sum the index of my event in the subarray with the indexes i excluded from the original array in order to understand at what index that happens (because i need to know when a certain event happens).
Isn't there something like the Search Waveform palette where i can automatically start "scanning"at a certain index?
09-26-2019 03:41 AM
Isn't that what the Start Index input is for?
/Y
09-26-2019 03:45 AM
Yes i was asking if there is something similar for arrays without having to use an Array Subset
09-26-2019 03:46 AM
Ok my mistake i just found it dumb question, thanks again 😉
09-26-2019 04:14 AM
Hi Bonifacio,
Isn't there something like the Search Waveform palette where i can automatically start "scanning"at a certain index?
Some array functions like Search1DArray also allow to input a start index…
What's wrong with a simple ADD function to manipulate an index value? (Basically the equivalent to pointer arithmetic in low-level programming languages like Assembler.)