02-24-2013 07:00 PM
HI all,
I have written a program and was getting some errors so stepping through debugging it. Ive used a for loop to cut the data going from the peak max working back and finding the data point which is the first point above a given threshold. When i was checking the location values of the peak max i was getting random values and only 5 when i have asked the for loop to execute 20 times and i have at least 30 peaks of data. The same data feeds into other VI's with no issue. So i ran the VI in debug mode. THe via executes 20 times then passes the data on. IT then starts again and runs a further 20 times and passes that on then runs 5 times and passes that on. I am thinking that perhaps the correct values (that come out the first time) are being overwritten when the for loop re executes. I have no idea why this is happening though. I have run a very similar loop that goes from the peak and works forward and I have no issues with that one.
Does anyone have any suggestions please.
I have posted the vi plus a screen shot cos i have one of the newer labview versions. THanks
02-24-2013 07:56 PM
You did not attach the subVI
You have an input with auto-indexing enabled and a value wired to the N terminal. Do not do both. You should understand that the loop will iterate for a count equal to the lesser of the array size or N count.
02-24-2013 10:13 PM
Dennis is correct.The loop is going to execute either the Count Terminal or the FMax array size, whichever is smaller. If changing that doesn't solve the problem, does turning off the Parallel For Loop execution fix it?