# How to turn a constant vector into a matrix?

0

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

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

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

• ### Aptech Systems, Inc. Worldwide Headquarters

Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Want to find out more?

Get a real answer from a real person

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!