How do I concatenate matrices in GAUSS?

I have a matrix of observations and I want to add a constant vector as the first row of my matrix. How can I concatenate these two variables in GAUSS?

1 Answer


Numerical data

For matrices and vectors use the tilde (~) operator for horizontal concatenation and the pipe (|) operator for vertical concatenation. For example if you have two 5x1 vectors A and B, you can concatenate them into a 5x2 matrix like this:

newMat = A ~ B;

You could vertically concatenate them into a 10x1 vector like this:

newVec = A | B;

String Arrays

String arrays use the tilde (~) and pipe (|) operators, but they are prepended with the dollar sign ($). For example:

stringArrC = stringArrA $~ stringArrB;
stringArrD = stringArrA $| stringArrB;



Your Answer

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.


Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap