LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Manipulation

Hello,

 

I have an array that I am acquiring from a test bench.  It is always 1000 rows long and 11 columns wide.  There are only 3 columns of the data that I am actually interested in.  I have figured out how to delete the columns that i do not want.  That is not a problem.  The problem I am having is that the data that I want to keep is in a different column location from test to test.  There is some constancy in the test data though.  Each time the test runs there is one column that contains the number 65532 and the data that I am interested in is in the subsequent (kind of) three columns.  It seems like I need to be able to determine which column has 65532 then reorganize the columns so that I can delete the columns I do not need.  An additional problem I have is if the 65532 occurs in column 10, then the data I need resides in columns 11, 1 and 2.

 

Any ideas or pointers on how I could attack this problem?

 

Here is a visual example of what I am talking about.  Pretend column g contains the number 65532.

 

a  b  c  d  e  f  g  h  i  j  k     <-- Raw Data

 

g  h  i  j  k  a  b  c  d  e  f     < --- Format I am looking for

 

Thanks.

Ron

0 Kudos
Message 1 of 4
(2,150 Views)

Hi Ron,

 

- search for the magic number in your 2D array column-wise, resulting in column "x".

- When found you simply index the columns (x+1) mod 11, (x+2) mod 11, and (x+3) mod 11

 

You should adapt to "official" counting of rows/columns starting with zero. So the 10th column has index 9, while the 1st one has index 0...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,141 Views)
Hi, Thanks for the advice. You will have to excuse me I am kind of a newbie. Is there a .vi that exists for searching the array and returning the column. I think this is the specific part that I am struggling with. Thanks for your help. Ron
0 Kudos
Message 3 of 4
(2,127 Views)

Hi Ron,

 

If you transpose the array, then it gets pretty easy.

 

Find Column.png

 

The "Found?" wire can be used for error checking.

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 4 of 4
(2,118 Views)