LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select first element of an array from a FOR loop

Solved!
Go to solution

Hi.

I use Labview 8.5

In my application I have a "for" loop where I read some values from a device. (strings and numeric)

As you know Labview "stores" the values until the "for" loop is terminated, and then they get out into an array.

OK.

I want to use just the first element for strings and numeric, and after that to do something with him, like compare (for numeric)

For strings I used with succes "Split 1D Array" and choose "first subarray". Good.

Now, for numeric works that too, but the result is one element, array type too. I need it to be numeric (decimal) not array type, because I need to compare him (greater than 0). Then use a Case......

So, One element array in one numeric decimal ? Or array to first decimal element. How to ?

 

I tried with Array subset too. Same think.Smiley Sad Labview don't let me compare a 1D array with 0. It's logical, but how to convert, to have just first decimal element ?

 

 

 

0 Kudos
Message 1 of 3
(9,391 Views)
Solution
Accepted by topic author dsasorin

Try using the "Index Array" function. If you do not wire a value to the index terminal it will return the first elelemnt in the array. If you wire an index it will return the value specified.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 3
(9,389 Views)

Thank you. It works now.

0 Kudos
Message 3 of 3
(9,360 Views)