03-21-2013 12:00 AM
can i kw wat is the function used within d case structure,,,,
03-21-2013
01:26 AM
- last edited on
01-10-2025
02:08 PM
by
Content Cleaner
harshi8@8592 wrote:
can i kw wat is the function used within d case structure,,,,
Max & Min (found in the comparison palette)
03-21-2013 02:53 AM
For completeness, here's the first method I suggested earlier:
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.
03-21-2013 01:46 PM
@tst wrote:
I'm sure Altenbach can pick apart the various versions for all their performance characteristics.
Has he done this before?
03-21-2013 02:00 PM
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.
03-21-2013 02:23 PM
@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".
03-21-2013 02:31 PM
@crossrulz wrote:
Just so you know, "Knight of NI" is a forum title.
... and it got significantly more ambiguous this week! 😄
03-21-2013 02:54 PM
@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.
03-21-2013 05:14 PM - edited 03-21-2013 05:15 PM
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 altenbach created but for 1D array (attached)
and then use it for every row in order to create an array that is build up from the minimum in every row.
and then use the subVI again (possible to use the regular Array Max & Min function now, since there are no zeros)
on the array of the "minimums", to find the absolute minimum.
03-21-2013 05:56 PM
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