LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting 1d array of double

I have a 1-D array of double inside of a while loop.  I would like to control the execution of the while loop based on one of the numeric values in that array (like I would stop the while loop if the numeric value in the array is less than or equal to 0).  How should I go about doing this? 
 
I cant link the array directly to the "less than or equal to 0" icon because it requires a single double.  Any help would be much appreciated.  Thanks. 
 
Jerry
0 Kudos
Message 1 of 7
(12,070 Views)

Jerry,

Your right you cant connect an array of number to the comparision vi's because they need a single number.  What you need to do is index the array with the Index Array vi.  This will let you pick out a single number from your array of numbers.  If you connect the loop iteration (i) to the Index Array vi it will index through your whole array but just make sure you setup conditions to make sure your while loop will always stop.


Brian

See attachment

Message Edited by BrianPack on 09-07-2005 02:48 PM

0 Kudos
Message 2 of 7
(12,060 Views)
Yep, BrianPak spoke truth.  Here is an example of random numbers from 0 to 10.  The while loop stops before the end if 0 is encountered.
0 Kudos
Message 3 of 7
(12,045 Views)
It might be easier to use the Less Or Equal? operator set to Compare Elements mode, which would give you an array of booleans.  Then OR that entire array, which would give you a single double.

0 Kudos
Message 4 of 7
(12,036 Views)
or you could do it this way



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 7
(12,027 Views)


@qiora wrote:
I cant link the array directly to the "less than or equal to 0" icon because it requires a single double. 

Of course you can connect an array to "less than or equal to 0". The output will be a boolean array that you can feed into a "OR array elements" or "AND array elements" to get a true if either (1) at least one array element matches or (2) all elements match, respectively.
 


@qiora wrote:
I would like to control the execution of the while loop based on one of the numeric values in that array (like I would stop the while loop if the numeric value in the array is less than or equal to 0). 
If it should be based on one specific element (e.g. element(0) or element(5)), you need to get that element using "index array" and do the comparison.
 
The implementation will depend on your exact requirement. Your question is quite ambiguous. 🙂
0 Kudos
Message 6 of 7
(12,016 Views)
i got it... thanks guys.
0 Kudos
Message 7 of 7
(12,001 Views)