07-16-2019 11:00 AM
Hi, I have the array:
thor: ipc info 00:38:26.109 MHR 71.12, Quality 0.44, Valid 0
thor: ipc info 00:38:26.127 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:27.119 MHR 70.90, Quality 0.33, Valid 0
thor: ipc info 00:38:30.117 MHR 70.66, Quality 0.06, Valid 0
thor: ipc info 00:38:30.121 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:31.113 MHR 70.24, Quality 0.08, Valid 0
thor: ipc info 00:38:31.121 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:32.107 MHR 70.16, Quality 0.09, Valid 0
thor: ipc info 00:38:32.123 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:33.125 MHR 70.16, Quality 0.29, Valid 0
thor: ipc info 00:38:33.129 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:34.121 MHR 70.10, Quality 0.19, Valid 0
thor: ipc info 00:38:34.136 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:35.113 MHR 70.06, Quality 0.31, Valid 0
thor: ipc info 00:38:35.120 FHR 134.83, Quality 0.00, Valid 0
thor: ipc info 00:38:35.372 Tap detected! 1 taps!
thor: ipc info 00:38:33.125 MHR 70.16, Quality 0.29, Valid 0
thor: ipc info 00:38:33.129 FHR 134.83, Quality 0.00, Valid 0
The line: thor "ipc info 00:38:35.372 Tap detected! 1 taps!" could be at any row in this array. How do I search the rows to extract this string wherever it may be?
07-16-2019 11:17 AM
Use the Search 1D Array function.
https://zone.ni.com/reference/en-XX/help/371361G-01/glang/search_1d_array/
07-16-2019 12:05 PM
Use a FOR loop to index over the array. Use whatever checking algorithm you deem necessary to check each line. When you find the line, stop the loop (enable the Conditional Terminal) and output the value from the i terminal. You should also output the result of the last check so you know if the loop actually found something or it just ran out of elements.
07-16-2019 12:43 PM - edited 07-16-2019 12:46 PM
Does that array element exist exactly once and you want to find the index?
Are all matching elements verbatim identical or are there variable parts that should be ignored?
I am not familiar with the term "extract". Do you want to delete all matching array elements, making the array smaller? For that, a for loop with a conditional output tunnel would do the job.
If there is never more than one occurrence, search&delete from array would work.
Please define the problem better!