LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop

Hi,
 
I have an 1D array and i want my VI to search for a value which is bigger than for example 2. When he got it, i want him to give me the position in this array...
I cannot be that difficult, but i´m not able to make it!!
 
Thanks, Thomas
0 Kudos
Message 1 of 4
(2,817 Views)
Have a look at this:

Ton



Message Edited by TonP on 12-03-2007 10:59 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 4
(2,814 Views)
Hi Thomas,

if you insist on using a loop:


You only have to check for empty array...


Message Edited by GerdW on 12-03-2007 11:46 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(2,802 Views)
The two solutions above are both great and which one's better depends a bit on your data. For example if your arrays are huge, but the match occurs typically in the first few elements, GerdW's solutions is probably more efficient. Ton's solution is simpler and easier to read and sufficient for typical data sizes.
 
If you have LabVIEW 8.5, you can also enable the conditional terminal for the for loop, significantly simplifying the code. 🙂
 


Message Edited by altenbach on 12-03-2007 08:44 AM
0 Kudos
Message 4 of 4
(2,766 Views)