LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mod function in LabView's Configure Formula

Good afternoon, all.  Today is my first shot at using the Configure Formula feature in LabVIEW, and so far I'm not doing well with it.
The root of the problem may be in my (mis)understanding of the mod function in particular.  (I know what mod does, but not how to use it in LabVIEW.)
 
Here's the formula: J=1+(((((C/100)%4)*5)+G)%7), where % indicates use of the mod function.
 
I can enter the formula successfully if I use a standard division symbol in place of the %, but once I try to use the mod function, it all goes to worms.  Can anyone offer me an example of the use of mod in Configure Formula?  (Or perhaps guide me on how to get my formula to work in Configure Formula?)
 
Thank you very much.
-Dan
0 Kudos
Message 1 of 8
(8,409 Views)
Dan,

I had no trouble entering: J = mod(mod(C/100,4)*5+G,7)+1.

Look at the attached VI for three ways of implementing your equation (LV 7.1).

Be aware that comparing real numbers for equality may sometimes fail due to the way numbers are represented in binary in the computer.

Lynn
Message 2 of 8
(8,399 Views)

Wow, thank you so much for your help.  Looks like the root of the problem was my not correctly understanding the syntax of the formula -- now that I've got your VI as an example, I can certainly have much better luck with this in the future.  Thanks again,

-Dan

0 Kudos
Message 3 of 8
(8,375 Views)
Just a simple VI to split a value to two bytes.
0 Kudos
Message 4 of 8
(7,093 Views)
You should be aware that you're responding to a four and half-year old thread. Also, I'm not sure how your example relates to the original problem. Were you trying to respond to another thread?
0 Kudos
Message 5 of 8
(7,078 Views)
I searched for the modulo function as I wanted to use it for splitting up a number into two numbers. Because I guessed that someone else might follow the same path and it was the 2nd hit on google I considered it to be a good idea to do so. The age of the thread is less important than the rating of google 🙂
0 Kudos
Message 6 of 8
(7,072 Views)

bachc wrote:
The age of the thread is less important than the rating of google 🙂

True, as far as the date is concerned, but the relevance is. Your modulo operation has nothing whatsoever to do with the original question. The only thing that's the same is the word "modulo".

 

As far as what you're actually doing, it doesn't really make much sense. If you try to reverse the mathematical operation in your case you do not get back to the original number. Also, you do not need to use the formula node to simply do what the Quotient & Remainder function already does. 

0 Kudos
Message 7 of 8
(7,063 Views)
sounds good, didn't know about that funktion. Thanks!
0 Kudos
Message 8 of 8
(7,039 Views)