Is there a GAUSS function that would allow me to take a vector and
turn it into a matrix with constant values in each column (or row)? For
example, I say I wanted to take the following:
X = 1 2 3
and from the values in X create the matrix
Y = 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
1 Answer
0
accepted
You can use the reshape function for this:
//Create a row vector X = { 1 2 3 }; //Reshape the row vector into a 5x3 matrix Y = reshape(X, 5, 3);
Now Y will equal:
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
Your Answer
1 Answer
0
accepted
You can use the reshape function for this:
//Create a row vector X = { 1 2 3 }; //Reshape the row vector into a 5x3 matrix Y = reshape(X, 5, 3);
Now Y will equal:
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3