04-21-2011 12:11 AM
Hi there. im having a problem with labview 2010. im not sure why and it is really weird.i have this for loop which i want to run for n-3 times where n is an array size. so i wire to the N of the for loop the output of the subtract operator and in the inputs of the subtract i put the array size and the 3 constant. but instead of giving me the result it alway gives me a -3. no matter what the size of the array is, the subtract operator always returns a -3. i tried replacing it for an add operator but it just gave me a +3 instead of a -3. so the for never executes. i tried recompiling it and deleting and redrawing the diagram with no success. i know it is a labview 2010 error cause i saved it for a previous version (8.6) and run it on another labview and it did the subtract correctly. here is the screenshot. i ran out of ideas any guesses? im downloading the service pack 1 to see if that helps. thanks in advance.
04-21-2011 12:30 AM
Hi,
could you post a small vi that can reproduce the problem ?
Regards,
04-21-2011 02:55 AM
If you wire to the N from inside the FOR loop, you get the actual number of the iteration that the FOR loop will run. This is the smallest of the following numbers (A: the number wired to N from the outside, B: the smallest array size wired to any of the autoindexing input tunnels). If the array size is derived from an autoindexing array, the outcome is most likely uninteresting. If any of the autoindexing array inputs is zero lenght, the for loop will not execute at all.
You don't show enough code to tell anything. Can you attach the actual VI that gives you problems?
The math from the probes does not add up. Try a cleanup operation to make sure there is nothing wired weird or hidden underneath the visible primitives.
04-21-2011 06:11 AM
no matter what the size of the array is, the subtract operator always returns a -3.
I would look for a wiring error. It LOOKS like the wire is coming from the OUTPUT of the subtract. But BEHAVIOR says that it's going UNDER the subtract and to the "-3" constant.
Triple-click that output wire and make sure it's going where you think it is.
LabVIEW has been able to subtract for almost 25 years now.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-21-2011 06:58 AM - edited 04-21-2011 06:58 AM
I agree with the above 2 posts.
I've never had math issues with LabVIEW.
My LV 2010 works well when trying what you described. See below:
04-21-2011 10:26 AM
Well, I can't make a small VI that reproduces the problem, it seems it is just this VI doing it. And it seems it is in just that specific point of the VI. I double checked the wiring to see if it was a hiding wire and it isn't. I'll post a bigger screenshot to make it more clear. It is not an autoindexing problem cause first of all I don't have any autoindexing in that for loop and I have the understanding that if you wire anything to the N then the autoindexing just indexes the array for the number you wire in N and gets overriden. but anyway that doesn't matter I have no autoindexing in the for loop. I'm going to install the service pack now and see if it works after that.
04-21-2011 10:33 AM
I'm not sure why you won't show us the whole picture. We STILL don't know where that value is coming from.
If you've checked the wiring, then it looks like the value is zero, but where does it come from?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-21-2011 10:43 AM
@Superjugy wrote:
... I have the understanding that if you wire anything to the N then the autoindexing just indexes the array for the number you wire in N and gets overriden.
That is not correct. If you auto-index an array that contains 5 elements, and you wire a 10 to the N, then the loop runs for 5 iterations, not 10. If the array is 10 elements long, and you set N to 5, then the loop runs for 5. It's always the smaller number.
If you can't make a small VI to reproduce the issue, can you upload the VI?
04-21-2011 10:52 AM
Of course anybody could make a subVI that looks exactly like a subtract operation. Have you tried double-clicking it to see if it opens a front panel? Maybe somebody is sabotaging your work or playing a practical joke. 😮
04-21-2011 12:08 PM - edited 04-21-2011 12:09 PM
well i dont think it is a joke, im the only one with access to this computer. i could upload the VI but it has lots of subVIs. but i guess i could. i don't know if it will work in you machines though... without the subVIs.
Thanks for the input about the autoindexing, that is something good to know. even though it doesn't help since i do not have autoindexing in that for loop.