02-22-2012 07:02 PM
Hi Is there a way how we can index each occurrence in the array?
It seems that search ID Array is once and I cannot figure out how to do it.
Please advise
Thanks in advance
Clement
Solved! Go to Solution.
02-22-2012 07:23 PM
Clement,
Occurrence of what? If you want to do something with each element of an array, use a for loop with auto-indexing enabled. You can put Search 1D Array in a loop with the start index connected via a shift register.
Lynn
02-22-2012 07:49 PM
I tried already but it does not work and I can't figure it out.
It does not work right way
See the pic below. How do we get index for each occreeneces in the array.
02-22-2012 07:52 PM
Actually, after I sort ID arr_input. that's how I get result of arr_index
regards
Clement
02-22-2012 08:03 PM
Clement,
So you want the index in arr_input of the element with the value 0, then with the value 5, and so on? Is that what you mean by "occurrence"? Do you want the first "0" or all of them? Do you need both the value and the index? How do you want the results displayed? What is the data represenstation - integer or double?
Lynn
02-22-2012 08:28 PM
Do you need only the indexes that matches the search element like this?
02-22-2012 08:39 PM
Hi P Anand,
Thanks which array function do you use. I can't tell from the look.
I tried every array function but it dies not work. I am using lab v7.1
Clement
02-22-2012 08:44 PM
I have used only build array function inside the for loop with a shift register. I treid the same with array functions but it didn't really work. Is that what you wanted to achieve?
02-22-2012 08:57 PM
Hi Thanks it nearly works but it is better than nothing. at least i know one of the function before proceeding .
Thanks
regards
Clement
02-22-2012 09:03 PM