07-30-2014 12:54 PM
I need your support in to solve some issue with my program, I have a while loop that detects peak values from a given array of data, when I push the stop botton it records the raw file with the write to spreadsheet VI. The thing here is that when i'm collecting the peaks from the data the while loop is running and while I'm moving the position of the cursors to find out another peak that period of time generates a bunch of repeated data from the previous peak and so on until I finish collecting the peaks. What i would like to do is to collect let's say 8 peaks, and only these 8 values has to be wirtten on the text file, eliminating all the repeated vales from a single peak. Does anybody here has an idea on how to solve this problem? I really need your support!
I'm attaching the part of the code that is doing the task, and also a sample raw file with the repeated values on it
07-30-2014 01:11 PM - edited 07-30-2014 01:13 PM
Your code picture does not make a lot of sense. What's up with the concatenate array after the while loop?
You don't need to remove duplicates unless you generate them first, so don't generate them. Use a "cursor release" event to only grab the max after the cursor has been moved to the new location.
07-30-2014 02:08 PM
Hi Mr altenbach,
thank you very much for your prompt response,
What I do is to gather all the index values from the while loop while I'm selecting the peaks, once I push the stop botton, all those values build and array with the peaks, but repeated as I explained before. As you said the concatenate array makes no sense, so I removed. The thing that it's not clear to me is the "cursor release event" you just mentioned, I have no idea on how to do that, can you help me out giving me an idea on how to do that?.
thanks in advance man
07-30-2014 02:15 PM
Your autoindexing output tunnel accumulates a new value every 500 ms, even if you don't do anything. (and if you would keep it running forever, the computer will run out of memory eventually!).
Attach your real code (not a picture) and I'll try to show what I had in mind.
07-30-2014 02:40 PM
07-30-2014 03:42 PM
Well, I haven't bothered with an event structure, but here's a quick modification that only adds a max it it hasn't been added before.
You still run into problems as the cursors are moved, because you might get a temporary max that is actually only the edge of a peak. I would probably add a button to manually add each valid point after the cursors have been moved to the new place.
07-30-2014 04:19 PM
That is correct, your statement is truth, you have to deal with the "temporary max" as you move the cursor. The modifications made were great, but still having those repeated values, I would like to see your suggestion putting the button to manually add each valid max value, how would you do that?
07-30-2014 05:11 PM
08-01-2014 10:18 AM
Perfect it works! you have to do it manually but compared to the time I had to invest eliminating the repeated values it is nothing. Right now what I'm struggling with is to only put the circles on the correct positions (real peaks) while moving the cursors.
thanks a lot for your support Mr altenbach