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.
已解决! 转到解答。
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
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.
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
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.
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.
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)