LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplex Multiple Columns into One

Solved!
Go to solution

Hello,

 

This seems to be a pretty basic question but I am struggling to get it to work.

 

I want to take a Matrix (1), and convert it into another Matrix(2) where Matrix(2) will have column 1 that was created from the concatenation of column 1, followed by column 2 ... etc from Matrix (1).  As a reult Matrix(2) will have more elements per column but less columns than Matrix(1)

 

Essentially all it is, is multiplexing a few rows from Matrix(1) into a new column in Matrix (2).

 

Thank you.

0 Kudos
Message 1 of 12
(3,571 Views)

Sounds like you want Resphape Array.

0 Kudos
Message 2 of 12
(3,565 Views)

Do you have an actual example of inputs and what you expect for an output?  I could interpret your problem in many ways.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 12
(3,561 Views)

I have attached a screenshot of the set up I have so far. The output of the while loop will be column 1, 2 and I want to store that in chronological order in a single column of a new matrix.

Thank you.

0 Kudos
Message 4 of 12
(3,552 Views)

I am actually even more confused about what you want.  How would you expect the bytes to be combined?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 12
(3,548 Views)

I have attached a paint picture of what I am trying to do, ignore what I said before, don't want any confusion.

0 Kudos
Message 6 of 12
(3,545 Views)

I'm with RavensFan.  Looks like you just need to use Reshape Array.  You may need to transpose the array before and/or after the reshaping.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 12
(3,534 Views)
Solution
Accepted by topic author algoballer

Yes.  You do need a transpose array before reshaping.

 

First function Array Subset is to get down to the 3 columns.

 

Transpose 2D Array.

Array size and mulitply array elements to get total number of elements in Array.

Reshape Array

 

Message 8 of 12
(3,521 Views)

Thank you very much for your help! Works perfectly! If you don't mind explaining, why is it necessary to transpose the array, I would have never thought of that.

0 Kudos
Message 9 of 12
(3,513 Views)

@algoballer wrote:

Thank you very much for your help! Works perfectly! If you don't mind explaining, why is it necessary to transpose the array, I would have never thought of that.


Because 2D arrays are stored with the rows in memory order and reshaping does not touch the memory order, just interprets the existing elements as a differently dimensioned array. You need to transpose to turn the columns into rows. Once it is a 1D array, there is no longer a row/column distinction.

0 Kudos
Message 10 of 12
(3,486 Views)