LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare a scalar with individual 1d array elements

Solved!
Go to solution

Hi all,

I have a scalar value and a 1d array. I want to compare scalar with each elements of 1d array and extract the values which are higher than the scalar into a separate 1d array.

Can anybody suggest me how to go about it.

 

 

 

 

 

Regards,
KM
0 Kudos
Message 1 of 7
(3,266 Views)

Hi, kamasani

 

Use for loop can do it.

 

u can see the attachment

 

 

Patrick

Certified LabVIEW Developer
0 Kudos
Message 2 of 7
(3,261 Views)

Hi Patrick,

Thanks for your time,

I am using LV 2011, i am unable to open since the program is in LV 2014. Can you plz post a screen shot of the VI attached.

Regards,
KM
0 Kudos
Message 3 of 7
(3,246 Views)
Solution
Accepted by topic author KevinKM

Hi kamasani,

 

ok, I convert vi to 2011.

 

 

Certified LabVIEW Developer
0 Kudos
Message 4 of 7
(3,237 Views)

Hi Patrick,

Thanks for your reply, i was expecting a different output. I figured it out myself after i had a look at your program. I have attahced the program with modification.

Regards,
KM
0 Kudos
Message 5 of 7
(3,230 Views)

Kamasani,

 

You do not need the for loop.  The attached VI shows how to get the same result without it.This takes advantage of the polymorphism of many numeric and boolean functions.  In your original post you asked to extract the values above the threshold into a separate array. The code at the bottom of the VI attached shows how to get an array with only those elements (no zeros). Of course this no longer has information about where those elements were in the original array.

 

Lynn

Message 6 of 7
(3,201 Views)

Patrick0418 wrote:

ok, I convert vi to 2011.


This does not solve the described problem, which is" "... I want to compare scalar with each elements of 1d array and extract the values which are higher than the scalar into a separate 1d array."

 

Typically, the output array is thus shorter. In your code, the output array remains the same size as the input.

 

Look at Lynn's solution (bottom of his diagram).

0 Kudos
Message 7 of 7
(3,194 Views)