05-31-2012 02:00 PM
@smercurio_fc wrote:
...Pesky mathematicians.
Makes me want to tell the jokes about how mathematicians give accurate information that is useless or makes no real sense...
05-31-2012 03:13 PM
@stu Turner wrote:
The "Sign" function in the Numeric palette returns a "-1" for a negative number and a "1" for a positive number. If you multiply your non-zero number by the outcome of this function, your number is returned positive and this becomes essentially a Mod[number] function.
FYI, LabVIEW does have an absolute value function in the numeric palette as well so you don't need to create one that way.
06-01-2012 02:42 AM
Kunsheng,
the and primitive may be your friend here. It will return 1 for every odd number an 0 for every even number.
You can also unleash it on the whole array - no iterations necessary!
Regards Florian
06-01-2012 08:40 AM
Florian, the original post is over three years old so I imagine the point is moot by now... Good point though!
06-01-2012 09:54 AM
Now that you mention it.
I just didn't look at the date of the original post - and from the fourth post on they're all very recent.
01-17-2017 10:12 AM
When using integer maths, the better solution is to use the expression node (in the numeric functions palette).
e.g. x%5
This is much faster than using the quotient remainder, as it is a single clock cycle (no divisions and multiplications internally).
e.g. to find odd/even integers x%2 then have a case for 0 or not zero
Very strange that mod is not visible as a numeric function in LabView.... I guess it is a slip up by NI
01-17-2017 10:32 AM
Forgot to mention:
mod is not equivalent to remainder (mod can give -ve results for -ve values....... ..... but remainder is always positive)