Resources

How do I concatenate matrices in GAUSS?

0

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?

asked August 17, 2012
admin
27

1 Answer

0

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;
admin
27