08-20-2013 10:12 AM
I'm trying to carry out peak detection on a waveform. I'm using the Waveform Peak Detection VI for this. One of the outputs of this VI is an array of the "locations" of each peak.
The locations array is being displayed on the front panel, and it shows each element. I want to be able to extract a specific element of the array though, say the third element (value = 226). I've tried to do this using the index array function, but I think my understanding of that function was incorrect. It looks like it can only isolate a 1D array from a multidimension array?
I'm sure the answer is quite simple, but I'm scratching my head trying to find it. Many thanks in advance.
Solved! Go to Solution.
08-20-2013 10:19 AM
It would be a good idea to submit your code, but from your explanation, if you only know the value and not the index, then search using the value (gives you the index) then use that index as the starting point to get the array elements (you may have to specify the length as well).
08-20-2013 10:22 AM - edited 08-20-2013 10:23 AM
Your input is an array of waveforms, thus you will get an array of peaks for each waveform. You are extracting the first elements, which is a cluster containing an array of peaks for the first waveform. (Since LabVIEW cannot have arrays of arrays, youll get an array of clusters, each containing a 1D array).
If you only have one waveform in the input array, you should use index array before the peak detection and feed it only one waveform to get a plain 1D array output.
If you want to analyze an array of waveforms, you simply need to dig a little deeper from the output you get. Index array to get the result from one waveforms (that's what you currently do!), then unbundle to get the results array of that waveform, then index array again to get the first peak.
08-20-2013 10:33 AM
Thanks guys.
@altenbach: you were spot on. I had only one waveform in the array cluster, but using the index array function to access my 1D array solved everything.
Many thanks for the help.