LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting row and column of an array element

Solved!
Go to solution

Hi,

 

I have an array of 24 rows and 24 column giving me a total of 576 elements. How do I get the row and column of a particular element in an array in LabView. E.g. If I have to write to element 127 how do I get the column and row in which element 127 is located.

 

Regards,

Harshil

0 Kudos
Message 1 of 5
(3,056 Views)

Hi Harshil,

you can use the "search  1D Array" function inside a for loop. Connect your 2D array to the loop and then to the search function. If the search result is not equal to -1 then you have found a result. The result of the search function gives you the column and the "i" connector of the for loop the row.

 

Another option would be to first reshape your 2D array to 1d and search inside of it. If you have the result, you can recalculate it to column and row.

 

Mike

Message Edited by MikeS81 on 05-02-2010 12:53 PM
0 Kudos
Message 2 of 5
(3,054 Views)
Solution
Accepted by hkhiroya

Hi Harshil,

 

maybe you only need to find the correct "address" of the element in your 2D array?

 

Use something like this:

GetElement.png

Maybe you have to switch Row&Column output according to your numbering scheme...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(3,029 Views)
This will give you the row that you want.
0 Kudos
Message 4 of 5
(3,018 Views)
I didn't think to add this, here you can find the column and row.
0 Kudos
Message 5 of 5
(3,009 Views)