取消
显示结果 
搜索替代 
您的意思是: 

maximum five values in 2d array

已解决!
转到解答

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.

1 条消息(共 7 条)
4,028 次查看
解答
接受人 theresmychippy

this would be a bit faster眨眼表情

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
2 条消息(共 7 条)
4,025 次查看

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 项奖励
3 条消息(共 7 条)
3,854 次查看

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 项奖励
4 条消息(共 7 条)
3,844 次查看

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 项奖励
5 条消息(共 7 条)
3,824 次查看

Hello freddearaujo,

Although I see your clarification on 

 

JY
Application Engineer, RF and Communications
National Instruments
0 项奖励
6 条消息(共 7 条)
3,776 次查看

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 项奖励
7 条消息(共 7 条)
3,762 次查看