LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find maximum in array inputs

Solved!
Go to solution

Dear All,

 

I would like to find and replace the highest value among a set of values being polled.  I only manage to find the highest value if i compare the new value with the old value using a shift register with a single value (element) only.

 

Right now, if i am dealing with array inputs instead of single value, how should i do it?

 

Example:

 

New Input1=[5

                     4

                     3

                     2

                     1]

 

 Input 2= [  4

                   3

                   5

                   3

                   3]

 

 Therefore the answer should be  x=  [5

                                                         4

                                                         5

                                                         3

                                                         3]

 

 

Then if another new input array has higher values then x, the answer will again be modified.The values are compared by row versus row of each elements in the array. The final answer should be in array form.

 

 

Can anyone help out with this? Thank you so much!

 

 

                                               

0 Kudos
Message 1 of 14
(14,673 Views)

One way, this is the first one that jumped to mind. May be an easier one out there.

 

Message Edited by for(imstuck) on 04-22-2010 10:37 AM
Message 2 of 14
(14,668 Views)
Example_VI_BD.png
--
Tim Elsey
Certified LabVIEW Architect
Message 3 of 14
(14,660 Views)

Have you tried the following labview function?

 

Array Max & Min Function

 

 

  Array Min & Max.JPG

 

Message 4 of 14
(14,656 Views)

Dear else and for,

 

 

My input is forever polling there so do i need any shift register to keep track of the last highest value array? By the way, can you tell me what functions icon you use, i cant find the icon? Can attach the VI or snippet? 

0 Kudos
Message 5 of 14
(14,640 Views)

newbieboy wrote:

Dear else and for,

 

 

My input is forever polling there so do i need any shift register to keep track of the last highest value array? By the way, can you tell me what functions icon you use, i cant find the icon? Can attach the VI or snippet? 


 

Use Tim's(elset191) solution. It's cleaner. I didn't know it accepted arrays. The function is max& min and is under programming->comparison. 

 

As for your question about the shift register, you would then feed the (max,min) array into a shift register to be compared again next time.

Message Edited by for(imstuck) on 04-22-2010 11:26 AM
0 Kudos
Message 6 of 14
(14,627 Views)
Solution
Accepted by topic author newbieboy
Example_VI_BD.png
--
Tim Elsey
Certified LabVIEW Architect
Message 7 of 14
(14,617 Views)

elset191 wrote:
Example_VI_BD.png

WINNER WINNER, CHICKEN DINNER

0 Kudos
Message 8 of 14
(14,613 Views)

Dear Else,

 

 

I have attach my VI but i am not sure how come the max (x,y) is all zero?

 

Please help!

0 Kudos
Message 9 of 14
(14,604 Views)
I'm not sure either, I can't open your VI.  I'm using 8.6
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 10 of 14
(14,602 Views)