06-02-2016 09:20 AM
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.
Solved! Go to Solution.
06-02-2016 09:32 AM
Sounds like you want Resphape Array.
06-02-2016 09:34 AM
Do you have an actual example of inputs and what you expect for an output? I could interpret your problem in many ways.
06-02-2016 09:53 AM
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.
06-02-2016 10:01 AM
I am actually even more confused about what you want. How would you expect the bytes to be combined?
06-02-2016 10:08 AM
I have attached a paint picture of what I am trying to do, ignore what I said before, don't want any confusion.
06-02-2016 10:25 AM
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.
06-02-2016 10:46 AM - edited 06-02-2016 10:49 AM
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
06-02-2016 11:18 AM
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.
06-02-2016 11:36 AM
@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.