From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-24-2014 10:54 AM
i am working on a project in which i am trying to find the coordinates of the highest element of that array ...please help
Solved! Go to Solution.
03-24-2014 10:59 AM
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.
03-24-2014 12:21 PM
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.)
03-24-2014 12:50 PM - edited 03-24-2014 12:54 PM
Let's stop this Rube in its tracks.
indexes? Nice one. Indices is so old-fashioned these days...
03-24-2014 01:09 PM - edited 03-24-2014 01:10 PM
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
03-24-2014 01:15 PM
That is exactly what the snippet posted by Darin.K will provide. Try it.
Lynn
03-24-2014 01:41 PM
@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.
03-24-2014 01:49 PM
@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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-24-2014 04:15 PM - edited 03-24-2014 04:16 PM
@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.
12-14-2021 11:32 PM
I did the same thing as your question. My solution is:
- Reshape your 2D array to become a 1D array, for ex: your 2D is 4*4 and 1D reshaped is 1*16
- Use array Min and Max to find out Max value and Max index.
- Assume that your Max index is 10 = 4+4+2 so it means your coordinate of the Max value is (3,2)
Hope that my answer can help you.