# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Multiplex Multiple Columns into One

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.

Message 1 of 12
(3,372 Views)

## Re: Multiplex Multiple Columns into One

Sounds like you want Resphape Array.

Message 2 of 12
(3,366 Views)

## Re: Multiplex Multiple Columns into One

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

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
Message 3 of 12
(3,362 Views)

## Re: Multiplex Multiple Columns into One

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.

Message 4 of 12
(3,353 Views)

## Re: Multiplex Multiple Columns into One

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

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
Message 5 of 12
(3,349 Views)

## Re: Multiplex Multiple Columns into One

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

Message 6 of 12
(3,346 Views)

## Re: Multiplex Multiple Columns into One

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.

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
Message 7 of 12
(3,335 Views)
Solution
Accepted by topic author algoballer

## Re: Multiplex Multiple Columns into One

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,322 Views)

## Re: Multiplex Multiple Columns into One

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.

Message 9 of 12
(3,314 Views)

## Re: Multiplex Multiple Columns into One

@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.

Message 10 of 12
(3,287 Views)