Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
cat
concatenate several arrays
Syntax
y=cat(dims,A1,A2,...,An)
Arguments
- dims
a positive real scalar.
- A1,A2,..An
scalars, vectors, matrices or multi-arrays, or cell arrays.
A1,A2,...,Anmust have the same size (excluding the dimension numberdims).size(A1,i)=size(A2,i)=...=size(An,i)foridifferent of dims andsize(A1,dims), size(A2,dims),...,size(An,dims)can be different.- y
a scalar, vector, matrix or multi-array, or cell array
yhas the same type asA1,A2,...,An.
Description
y=cat(dims,A1,A2,...,An) : y is the result of the
concatenation of the input arguments A1,A2,...,An.
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 6 ;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
- brackets [..] — Concatenation. Recipients of an assignment. Results of a function
- lstcat — list concatenation
- permute — permutes the dimensions of an array
- matrix — reshapes an array with the same number and order of components
| Report an issue | ||
| << Matrix - shaping | Matrix - shaping | flipdim >> |