# LabVIEW

cancel
Showing results 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

Message 1 of 9
(723 Views)

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

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.

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

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

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.)

Message 3 of 9
(702 Views)

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

Let's stop this Rube in its tracks.

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

Message 4 of 9
(690 Views)

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

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

Message 5 of 9
(677 Views)

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

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

Lynn

Message 6 of 9
(670 Views)

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

@Darin.K wrote:

Let's stop this Rube in its tracks.

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.

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

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

@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.

Message 8 of 9
(655 Views)

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

@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

(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.
Message 9 of 9
(635 Views)