Language Reference


ROWCAT Function

ROWCAT (matrix <, rows> <, columns> );

The ROWCAT function concatenates rows of a character matrix without using blank compression. In particular, the function takes a character matrix or submatrix as its argument and creates a new matrix with one column whose elements are the concatenation of all row elements into a single string.

The arguments to the ROWCAT function are as follows:

matrix

is a character matrix or quoted literal.

rows

select the rows of matrix.

columns

select the columns of matrix.

If the input matrix has n rows and m columns, the result will have n rows and 1 column. The element length of the result is m times the element length of the argument. The optional rows and columns arguments can be used to select which rows and columns are concatenated.

For example, the following statements produce the $2 \times 1$ matrix shown:

b = {"ABC"  "D  "  "EF ",
     " GH"  " I "  " JK"};
a = rowcat(b);
print a;

Figure 25.333: Concatenation of Rows

a
ABCD EF
GH I JK



You can put quotes (") around elements of a character matrix in order to embed blanks or special characters, and to specify values that are lowercase or mixed case.

The syntax

ROWCAT (matrix, rows, columns);

returns the same result as

ROWCAT (matrix[rows, columns]);

The syntax

ROWCAT (matrix, rows);

returns the same result as

ROWCAT (matrix[rows,]);