LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the coordinates of the highest value element in an 2D array

i am working on a project in which i am trying to find the coordinates of the highest element of that array ...please help 

0 Kudos
Message 1 of 9
(723 Views)

Use Array Max & Min.  I'm pretty sure it only accepts a 1D array though, so you will want to put it inside of a FOR loop.  Autoindex on the rows on the 2D array and then do some comparison to see if your new Max is greater than your old max.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 9
(720 Views)

Reshape your array to a 1-D array and search for the max.  Now you have the coordinate you can do some basic math on to get back to the original row and column location.  (Remainder and quotient function would help here.)

0 Kudos
Message 3 of 9
(702 Views)

Let's stop this Rube in its tracks.

 

arraymax.png

 

indexes?  Nice one.  Indices is so old-fashioned these days...

Message 4 of 9
(690 Views)

Thanks for the replies but what exactly i asked was, for example if an 2D array  having 16 elements (i.e. 4*4)  and the greatest number of all the 16 elements is located [at lets say @ (3,2)] ,then my final out put should show me the column number and the row number 

0 Kudos
Message 5 of 9
(677 Views)

That is exactly what the snippet posted by Darin.K will provide. Try it.

 

Lynn

0 Kudos
Message 6 of 9
(670 Views)

@Darin.K wrote:

Let's stop this Rube in its tracks.

 

arraymax.png

 

indexes?  Nice one.  Indices is so old-fashioned these days...


I wasn't sure it would take a 2D array and didn't have a way to test it earlier.  Glad to see that it does.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 7 of 9
(659 Views)

@Darin.K wrote:

 

indexes?  Nice one.  Indices is so old-fashioned these days...


Not that I claim this site to be fact, but it states both are correct, but one is more common in America vs other English

 

http://grammarist.com/usage/indexes-indices/

 

Personally I prefer Indices, but what ever.

0 Kudos
Message 8 of 9
(655 Views)

@Hooovahh wrote:

@Darin.K wrote:

 

indexes?  Nice one.  Indices is so old-fashioned these days...


Not that I claim this site to be fact, but it states both are correct, but one is more common in America vs other English

 

http://grammarist.com/usage/indexes-indices/

 

Personally I prefer Indices, but what ever.


Eh, it's just so they don't have to write "Index/Indices."  So much more efficient to put "Index(es)."

 

edit

I like "indices," myself.  It rolls off the tongue so much more smoothly.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(635 Views)