LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hi everyone, i have a 2D array but i want to rearrange the order of the column. anyone please can help me?

hi everyone, i have a 2D array but i want to rearrange the order of the column. anyone please can help me?array.jpg

0 Kudos
Message 1 of 4
(3,685 Views)

LabVIEW Array functions, when handling multi-dimension arrays, can handle any of the array indices, but it is often easiest (and most "natural") to work with the first index, which (in convential 2-D terminology) means with "rows", rather than "columns".

 

One thing you could do is to use the Transpose 2D Array function to get your array "transposed", so the first Row is A E I M.  Now what you want to do is to remove the first two rows (splitting the array into First and Last rows), then put it back together again with the Last "first".  The function "Delete from Array" will do the splitting for you, then Build Array (I think that's the name of the function -- I don't have LabVIEW "up" right now) will put it back together, with you wiring the two halves in the "Last-first" order.  When you do this, be sure to right-click and select "Concatenate", as you don't want to combine 2 2D arrays and make a 3D array, but rather put two 2D arrays back-to-back.

 

You now have the transpose of what you want.  Transpose it once more, and (as the French say), voilà.

 

Bob Schor

Message 2 of 4
(3,681 Views)

Easiest would be to place the array inside a shift register, then swap columns pairwise as specified, keeping the 2D array in-place. Where does the information on the rearrangement come from? Does the array always have exactly four columns to be rearranged in the same way or are you looking for a scalable solution?

 

Another option would to to autoindex over all rows and do a "split..concatenate" for each row inside an autoindexing FOR loop..

 

 See how far you get.  What is the datatype of the array?

0 Kudos
Message 3 of 4
(3,659 Views)

Here is one of many potential solutions.

 

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
Message 4 of 4
(3,653 Views)