LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the minimum number greater than zero in an array

can i kw wat is the function used within d case structure,,,,

0 Kudos
Message 11 of 27
(2,116 Views)

harshi8@8592 wrote:

can i kw wat is the function used within d case structure,,,,


Max & Min (found in the comparison palette)

0 Kudos
Message 12 of 27
(2,107 Views)

For completeness, here's the first method I suggested earlier:

 

Find non-zero min.png

 

 

If we know that all the numbers are positive, then we don't need the case. Like I said, this is more about simple code and less about efficiency. To determine the most efficient method, we would need to know what actual typical data looks like. I'm sure Altenbach can pick apart the various versions for all their performance characteristics.

 

 


___________________
Try to take over the world!
0 Kudos
Message 13 of 27
(2,102 Views)

@tst wrote:

I'm sure Altenbach can pick apart the various versions for all their performance characteristics.


Has he done this before? Smiley Tongue

0 Kudos
Message 14 of 27
(2,080 Views)

amitai.abramson,

 

The numbers can be integers but NOT necessarily always so.

 

The shape of the array will not always be the same, it keeps changing.

 

Hope this clarifies.

 

Knights solution does the trick for all I have so far tried. There can be other solutions of course.

 

0 Kudos
Message 15 of 27
(2,076 Views)

@Daudo wrote:

Knights solution does the trick for all I have so far tried. There can be other solutions of course.


Just so you know, "Knight of NI" is a forum title.  His screen name is "Altenbach".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 27
(2,071 Views)

@crossrulz wrote:
Just so you know, "Knight of NI" is a forum title.

 ... and it got significantly more ambiguous this week! 😄

 

 

0 Kudos
Message 17 of 27
(2,065 Views)

@altenbach wrote:
 ... and it got significantly more ambiguous this week! 😄

Between the newly knighted knights and @Ranjeet_Singh it's hard to keep all you guys straight.

0 Kudos
Message 18 of 27
(2,058 Views)

So....

After finding out that the values datatype is not always an Integer,I have tried some stuff ...
you guys got this working just fine.

yet, feel I should share the same/different ways I found, feel free to comment.

 

1. (disregarding Performance, looks short)
    I found out the Array Max & Min function disregards NaN.

    I followed tst's way of thinking to turn the zeros to NaN by
    subtracting epsilon from the 2D array and then performing Square Root on the result.
    That action created a new array, with NaN instead of zeros and all the of the non-zero (positive) numbers remain
    relatively big or small from one another the same as in the original 2D array.
    So now we can use the Array Max & Min function safely to find the indexes of the Min,
    and also the Min Value (up to the power of 2)

 

2. (very close to what altenbach did)
     Creating a subVI similar to what

 

0 Kudos
Message 19 of 27
(2,047 Views)

In your code for 1. you should add epsilon to the minimum value after squaring.  If the minumum value in the original array was epsilon, then minimum output value would be reported as zero.

 

Lynn

0 Kudos
Message 20 of 27
(2,042 Views)