LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

maximum five values in 2d array

Solved!
Go to solution

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.

Message 1 of 7
(3,060 Views)
Solution
Accepted by topic author theresmychippy

this would be a bit fasterSmiley Wink

easier.png

 

After reshaping to 1d

Sort the array (smallest to largest)

Reverse it (Largest to smallest now

Get largest values from the beginning


"Should be" isn't "Is" -Jay
Message 2 of 7
(3,057 Views)

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.

 

 

 

 

 

0 Kudos
Message 3 of 7
(2,886 Views)

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

0 Kudos
Message 4 of 7
(2,876 Views)

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.

0 Kudos
Message 5 of 7
(2,856 Views)

Hello freddearaujo,

Although I see your clarification on 

 

JY
Application Engineer, RF and Communications
National Instruments
0 Kudos
Message 6 of 7
(2,808 Views)

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)

0 Kudos
Message 7 of 7
(2,794 Views)