### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

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

### What’s New in GAUSS 17

### Want to find out more?

### Have a Specific Question?

### Q&A: Register and Login

### 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!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall econometrics Editor error error codes error handling errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation license licensing linux loading data loop loops matrix manipulation Maximum Likelihood Maxlik MaxLikMT Memory multidimensional array optimization Optmum output PQG graphics procs random numbers strings structures threading### Recent Questions

- Does Gauss have similar function as " %in%" in R or "find" in matlab
- Shall I change from I7 6700K to Ryzen X1800
- inther procedure
- About precision of cdfMvn and multi-thread
- Axis fonts, LaTeX font in legend
- Indexing Procedures inside a loop
- G0008 : Syntax error
- basic syntax
- explain the following Code.
- G0064 : Operand missing

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

### Find out more now

### Find out more now

# Resources

# How can be created a column vector by appending the columns/rows of an array?

How can be created a column vector by appending the columns/rows of an array?

## 1 Answer

**Matrix case**

You can turn a matrix in GAUSS into a column vector with either `vec` or `vecr`. The `vec` function will append each of the columns of a matrix in to one column vector, like this:

x = { 1 2 3, 4 5 6, 7 8 9 }; vec_1 = vec(x);

will set `vec_1` equal to:

1 4 7 2 5 8 3 6 9

`vecr` will create a vector by concatenating the rows of the input matrix and then transposing it into a column vector. For example:

x = { 1 2 3, 4 5 6, 7 8 9 }; vec_2 = vecr(x);

will set `vec_2` equal to:

1 2 3 4 5 6 7 8 9

**N-dimensional array case**

You can reshape a GAUSS N-dimensional array into a vector with the `vecr` function. For example:

dims = { 2, 3, 4 }; a = areshape(seqa(1, 1, 24), dims);

will create the 2x3x4 dimensional array with the following contents:

Plane [1,.,.] 1 2 3 4 5 6 7 8 9 10 11 12 Plane [2,.,.] 13 14 15 16 17 18 19 20 21 22 23 24

Continuing the example:

v = vecr(a);

will create the column vector, `v` equal to:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

## Your Answer

## 1 Answer

**Matrix case**

You can turn a matrix in GAUSS into a column vector with either `vec` or `vecr`. The `vec` function will append each of the columns of a matrix in to one column vector, like this:

x = { 1 2 3, 4 5 6, 7 8 9 }; vec_1 = vec(x);

will set `vec_1` equal to:

1 4 7 2 5 8 3 6 9

`vecr` will create a vector by concatenating the rows of the input matrix and then transposing it into a column vector. For example:

x = { 1 2 3, 4 5 6, 7 8 9 }; vec_2 = vecr(x);

will set `vec_2` equal to:

1 2 3 4 5 6 7 8 9

**N-dimensional array case**

You can reshape a GAUSS N-dimensional array into a vector with the `vecr` function. For example:

dims = { 2, 3, 4 }; a = areshape(seqa(1, 1, 24), dims);

will create the 2x3x4 dimensional array with the following contents:

Plane [1,.,.] 1 2 3 4 5 6 7 8 9 10 11 12 Plane [2,.,.] 13 14 15 16 17 18 19 20 21 22 23 24

Continuing the example:

v = vecr(a);

will create the column vector, `v` equal to:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24