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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transposing data in an array using a For Loop

Solved!
Go to solution

I am trying to transpose some data in an array using a  for loop starting from the size of the array then decrement down to 0. Can someone please help if you have an example?

0 Kudos
Message 1 of 7
(2,531 Views)

You will need to be more specific for us to help. There is a Transpose 2D Array primitive in the Array palette.

 

Please give an example of exactly how you want the data transposed if that primitive does not do what you need.

 

Lynn

Message 2 of 7
(2,527 Views)

johnsold

 

For a 2 D array  if the values are 1 2 3 4 5 6 7  i would like it to read 7 6 5 4 3 2 1. The only thing is i need it to be done using a For loop instead of using Transpose vi. So I need this to check the size of the array  and i decrement down to 0.

 

It will start at 7,  6,  5, etc  which is position 6 in the array down to position 0. 

Message 3 of 7
(2,520 Views)

Hi *E*,

 

I don't know if this is what you want

Transpose 2D array with for loop.png

 

rearrange array.png

 

The first one will act similar as using transpose 2D array function. The second will change an order of element from 1234 to 4321

 

Hope this help

 

TuiTui

Message 4 of 7
(2,506 Views)
Solution
Accepted by topic author *E*

This sounds like a school exercise.

 

Determine how to calculate the index in the input array and how to calculate the index in the output array. Then use Index Array and autoindxing output tunnel or Index Array and replace Array Subset.

 

Lynn

Message 5 of 7
(2,503 Views)

I feel as if reverse 1D array may help

 

Edit: misunderstood what your second post meant.

0 Kudos
Message 6 of 7
(2,482 Views)

Thank you to everyone for your replies!

0 Kudos
Message 7 of 7
(2,447 Views)