LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does Labview have function Mod() ?

Solved!
Go to solution

Hello, everyone,

 

I am trying to parse an array only for all its odd/even number elements.  

 

I am thinking of use Mod function upon 'iteration' but labview seems have 

nothing there.   

 

Does anyone know something about that?  

 

 

Thanks in advance,

 

-Kunsheng

 

 

0 Kudos
Message 1 of 17
(31,645 Views)
Solution
Accepted by topic author Kunsheng Chen
It's the Quotient & Remainder function on the numeric palette.
Message 2 of 17
(31,639 Views)
If you want to get the modulus of a number then use the quotient & remainder function in the numeric panel (block diagram).  Use the top input labelled X-Y8Floor(X/Y).  This is the mod().
Message 3 of 17
(31,637 Views)

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.

0 Kudos
Message 4 of 17
(29,287 Views)

@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.


No, that is ABS(number).  MOD needs 2 inputs: the number and what the base is.  For instance MOD(3,2) is 1.  The easiest way to think of MOD is the remainder when you divide two numbers.


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 5 of 17
(29,277 Views)

I found my way to this page because I was looking for a modulus function in the mathematical sense, i.e. In mathematics, the absolute value (or modulus) | a | of a real number is the numerical value of a without regard to its sign.

0 Kudos
Message 6 of 17
(29,270 Views)

@stu Turner wrote:

I found my way to this page because I was looking for a modulus function in the mathematical sense, i.e. In mathematics, the absolute value (or modulus) | a | of a real number is the numerical value of a without regard to its sign.


Interesting.  I never heard absolute value be called modulus before.  I just hit wikipedia to check.  In every sense I've heard of modulus (including a few math and cryptography classes), it is remainder (http://en.wikipedia.org/wiki/Modular_arithmetic).


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 7 of 17
(29,266 Views)

I don't doubt your knowledge in this area, I was just defending my corner.

http://en.wikipedia.org/wiki/Absolute_value

 

0 Kudos
Message 8 of 17
(29,261 Views)

@Kunsheng Chen wrote:

Hello, everyone,

 

I am trying to parse an array only for all its odd/even number elements.  

 

I am thinking of use Mod function upon 'iteration' but labview seems have 

 




Save yourself the looping, why not just use decimate 1 D array?

 

Edit: Misread, you want the even/odd elements, not even odd indices.

0 Kudos
Message 9 of 17
(29,257 Views)

@crossrulz wrote:

@stu Turner wrote:

I found my way to this page because I was looking for a modulus function in the mathematical sense, i.e. In mathematics, the absolute value (or modulus) | a | of a real number is the numerical value of a without regard to its sign.


Interesting.  I never heard absolute value be called modulus before.  I just hit wikipedia to check.  In every sense I've heard of modulus (including a few math and cryptography classes), it is remainder (http://en.wikipedia.org/wiki/Modular_arithmetic).


That's because technically it's modulo, not modulus. Pesky mathematicians.

0 Kudos
Message 10 of 17
(29,251 Views)