11-22-2012 10:03 AM
Hi everyone,
I have 2 (x and y)local variables that are calculated by some formula, then I want to say if x > y then x=y. I want to know how to make x=y in labview
thanks
Solved! Go to Solution.
11-22-2012 10:09 AM
Valdi,
Why not try something like this:
I did use a local variable but it replaces it with a property node when you turn it to a snippet...
11-22-2012 10:41 AM
Loving the long wires! But don't they mean the data will take longer to travel along them
-CC
11-22-2012 10:42 AM - edited 11-22-2012 10:43 AM
Thanks a lot, I was close to it but didn't use a property node. But your idea does the job.. thanks a lot
11-22-2012 10:46 AM
The snippet kept squashing everything! lol besides I was told from a reliable source that its not the size of your wires, its how you use them!
11-22-2012 10:52 AM
Or like this:
11-22-2012 11:57 AM - edited 11-22-2012 11:57 AM
You seem to be using local variables as "variables", which is a bit odd for LabVIEW. Try to get away from this text programming mentality. 😄
Feel free to post your code.
Anyway, here's what you could do.
11-23-2012 03:47 AM
your solution works too.... thanks!
do you suggest anything rather than local variables, because now ive started to have problems as i have many local variables of the same variable and it seems that its confusing the program or slowing it or something...any suggestions?
11-23-2012 03:57 AM
Valdi,
By the sounds of things you are encountering what is referred to as 'race conditions'. As a rule of thumb try to use terminals and wires where possible, this avoids breaking the data flow paradigm and ultimately will help you debug.
11-23-2012 01:39 PM
valdi wrote:do you suggest anything rather than local variables, because now ive started to have problems as i have many local variables of the same variable and it seems that its confusing the program or slowing it or something...any suggestions?
Local variables are very rarely needed, except for UI features. In LabVIEW, you should think of the wire being the variable while terminals are tunnels to the surface to interact with the user.
If your code needs to keep track and update values, you could use a shift register in your loop to do read..modify..write, etc. There is no need to involve the front panel in a value that changes every nanosecond.
It is difficult to give more detailed advice without seeing some code. Feel free to attach a simplified version of what you are doing.