Scilab Function
Last update : 23/10/2007

cat - concatenate several arrays

Calling Sequence

y=cat(dims,A1,A2,...,An)

Parameters

Description

y=cat(dims,A1,A2,...,An) : y is the result of the concatenation of the input arguments A1,A2,...,An. if dims=1then the concatenation is done according to the rows : if dims=2 then concatenation is done according to the columns of the input arguments,...

if dims=1, then the concatenation is done according to the rows

A1=[1 2 3 ; 4 5 6]; A2=[7 8 9 ; 10 11 12]; y=cat(1,A1,A2) => y=[1 2 3 ; 4 5 61 ;7 8 9; 10 11 12]

if dims=2, then the concatenation is done according to the columns of the input arguments

A1=[1 2 3;4 5 6]; A2=[7 8 9 ;10 11 12]; y=cat(2,A1,A2) => y=[1 2 3 7 8 9 ; 4 5 6 10 11 12]

Examples

// first example : concatenation according to the rows 
dims=1; A1=[1 2 3]; A2=[4 5 6 ; 7 8 9]; A3=[10 11 12]; y=cat(dims,A1,A2,A3)
// second example :  concatenation according to the columns
dims=2; A1=[1 2 3]'; A2=[4 5;7 8;9 10]; y=cat(dims,A1,A2)
// third example : concatenation according to the 3th dimension 
dims=3; A1=matrix(1:12,[2,2,3]); A2=[13 14;15 16]; A3=matrix(21:36,[2,2,4]); y=cat(dims,A1,A2,A3)

See Also

permute ,   matrix ,  

Author

Farid Belahcene