LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to transpose 1D array

Dear all 🙂 

 

I wanna transpose a 1D array 

 

in other words

i wanna append these 3 1D arrays 

 

|1|     |2|     |3|

|4|     |5|     |6|

|7|     |8|     |9|

 

to this 2D one 

 

|1  4  7|

|2  5  8|

|3  6  9|

 

thanks for ur help in advace 🙂

0 Kudos
Message 1 of 17
(44,506 Views)

Transposing a 1D array is meaningless, since transpose works on 2D arrays. What have you tried? It's not clear from your picture whether your 1D arrays are the "rows" or the "columns" of what you show. Either way:

 

 

 

This is a pretty basic question. Have you done any of the LabVIEW tutorials? To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.

 

Message 2 of 17
(44,500 Views)

You can't transpose a 1D array (it only has one dimension!), but you can do what you want. You can use build array to combine the 3 vectors into 1 2D array, and then use Transpose Array on the 2D array.

 

Chris

 

Edit:

Damn , that was fast. And code too!

0 Kudos
Message 3 of 17
(44,493 Views)

no that's not what I mean 🙂 

 

my 1D arrays are columns 🙂

0 Kudos
Message 4 of 17
(44,490 Views)

It doesn't matter which way you display the 1D array. It is still a 1D array. The approach we described will work.

 

Chris

0 Kudos
Message 5 of 17
(44,487 Views)

@abdo712 wrote:

no that's not what I mean 🙂 

 

my 1D arrays are columns 🙂


"Rows" and "columns" are meaningless terms when it comes to 1D arrays. It's just an array. It has no direction. It becomes a "row" or "column" when it's placed into a 2D array.

0 Kudos
Message 6 of 17
(44,484 Views)

look 

i m getting my 1D arrays as a o/p from previous step (as columns 1D array) and the I have to add them to aother 2D array but each 1D array as a row in this 2D 🙂 

that's what i actually want 🙂 did u got me ? 🙂 

0 Kudos
Message 7 of 17
(44,477 Views)

Build Array adds rows to a 2D array (read the Help). If you have a 2D array to begin with, and increase its size by adding another row, just wire your 1D array (I don't particularly care whether you want to call it a "row" or a "column" as far as the 1D array is concerned) to the second input of Build Array to add another row to the 2D array.

 

 

 

Why don't you just try the operations yourself?

 

Also, please do not use text-speak abbreviations like "u".

Message 8 of 17
(44,473 Views)

But if you're multiplying matrices with vectors, it does make sense to transpose a 1-D array (or vector), so that the dimensions of your multiplication operation will match. How can I transpose a vector (1D array) so that I can multiply it correctly with a matrix?

0 Kudos
Message 9 of 17
(36,971 Views)

If you're going to bump a 4yr old thread, at least show us what you've tried and didn't work.

 

What have you tried?  Have you looked at the matrix calculations as you want to do matrix specific things?  If the math isn't working as you want, have you considered transposing your 2D array to change the way your 1D array would work with it?

 

Or, have you tried anything?  The 1D array doesn't have multiple dimensions to transpose. 

0 Kudos
Message 10 of 17
(36,953 Views)