LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Repeated Data from an Array

Highlighted

Hi guys,

 

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

 

Thanks!

 

Serge Armz

 

 

0 Kudos
Message 1 of 9
(741 Views)

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.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 2 of 9
(724 Views)

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

 

 

0 Kudos
Message 3 of 9
(708 Views)

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.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 4 of 9
(700 Views)

Mr altenbach

 

Here is the code

0 Kudos
Message 5 of 9
(692 Views)

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.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 6 of 9
(682 Views)

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?

0 Kudos
Message 7 of 9
(675 Views)

Use a latch action boolean button connected to the case selector.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 8 of 9
(661 Views)

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

 

SergeArmz

0 Kudos
Message 9 of 9
(613 Views)