01-18-2012 04:28 PM
Hi, I have a vi that reads in values from a 2D array and then uses this information. I am currently using the "Array Max & Min" vi to find the maximum values from the array. It may be beneficial for my application to find the maximum 5 or some other number of values in the array. My current plan is to use a loop that finds the maximum value from the original array and then subtract that value and repeat the operation 5 or so times. However, I believe this is innefficient and may take a long time in a vi that needs to run fairly quickly. I would appreciate some suggestion. Thanks in advance.
Solved! Go to Solution.
01-18-2012 04:45 PM - edited 01-18-2012 04:49 PM
this would be a bit faster
After reshaping to 1d
Sort the array (smallest to largest)
Reverse it (Largest to smallest now
Get largest values from the beginning
06-16-2015 11:47 AM
Hi,
In my case, I need to find peak values in the 2D array that, usually, are not the biggest values in the array. For example, in the color map below, I need to get the peak values that are isolated from each other. Any ideas?
Thanks in advance.
06-16-2015 12:03 PM
Do you need to find all the peaks? How do you define what is a peak? In the image you posted, how many peaks are there? 3? 7? 20? Do you need just the amplitude of the peak or also the locations? Can you post a VI or data file with some actual value? How noisy are the peaks?
Lynn
06-16-2015 12:35 PM
A peak would be a local maximum, i.e, it's the pixel whose value is greater than the all pixel around. In the image, each "island" would be a peak.
I need to find a finite number of peaks, the highest ones. This number can be set by the user, but for now, I am interested in the first two peaks only. The locations are not important.
I don't have any VI with actual values, but they stand about 0 to 100. This values are sound pressure level measured in dB.
My goal is exactly to know how noisy they are.
06-17-2015 04:11 PM
Hello freddearaujo,
Although I see your clarification on johnsold's question, I'm still wondering what excatly is a 'peak'. In more detail in "color map.jpg" would the "first" peak be at (50,90)? and then following that, where would the second peak be? Decribing a specific output for an input or test cases would be very helpful in understading your problem.
06-17-2015 07:10 PM
The peak would be the center of each "island" in the image. Acctually, it's a 2D array, I only plot it in a image because I thought it would be more understandable.
Yes, the first peak is at (50,90), the second one is at (200,70)