Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: English - Français - Português - Русский

# cat

### 呼び出し手順

`y = cat(dim, A1, A2, ...,An)`

### 引数

dim

A1,A2,..An

スカラー, ベクトル, 行列または多次元配列, またはセル配列. `A1,A2,...,An`は (次元`dim`を除き)同じ大きさとなります. `dim`以外の`i`について `size(A1,i)=size(A2,i)=...=size(An,i)` であり, `size(A1,dim), size(A2,dim),...,size(An,dim)` は異なる数とすることができます.

y

スカラー, ベクトル, 行列またはセル配列, `y``A1,A2,...,An`と同じ型となります.

### 説明

`y=cat(dim,A1,A2,...,An)`: `y` は,入力引数`A1,A2,...,An` を結合したものとなります.

`cat(1, A1, A2, A3)` is equivalent to `[A1 ; A2 ; A3]`. `cat(2, A1, A2, A3)` is equivalent to `[A1 A2 A3]`. Brackets are faster and must be preferred in both cases.

`cat()` is useful mainly for `dim > 2`, to build an hypermatrix or hypercell.

### 例

Example #1: Building a vector along dim #3

`cat(3, 4, -1, 3)`
```--> cat(3, 4, -1, 3)
ans  =
(:,:,1)
4.
(:,:,2)
-1.
(:,:,3)
3.
```

Example #2: Building a matrix of text of size(1,3,2):

`cat(3, ["a" "aa" "aaa"], ["b" "bb" "bbb"])`
```--> cat(3, ["a" "aa" "aaa"], ["b" "bb" "bbb"])
ans  =
(:,:,1)
!a  aa  aaa  !
(:,:,2)
!b  bb  bbb  !
```

Example #3: Stacking separate R G B layers of a mini RGB image:

```R = uint8(grand(2,4,"uin",0,255))
G = uint8(grand(2,4,"uin",0,255))
B = uint8(grand(2,4,"uin",0,255))
cat(3, R, G, B)```
```--> R = uint8(grand(2,4,"uin",0,255))
R  =
142    8   11  234
191  249  252   51

--> G = uint8(grand(2,4,"uin",0,255))
G  =
255  246  104  89
152   71  112  17

--> B = uint8(grand(2,4,"uin",0,255))
B  =
170  182  39  197
115  108  16   51

--> cat(3, R, G, B)
ans  =
(:,:,1)
142    8   11  234
191  249  252   51
(:,:,2)
255  246  104  89
152   71  112  17
(:,:,3)
170  182  39  197
115  108  16   51
```

Example #4: Building an hypercell:

```A1 = {%T   "abc" ; (1-%z)^2,  %pi}
A2 = {%s^2, gda(); %F, list(-5, "hello")}
cat(3, A1, A2)```
```--> A1 = {%T   "abc" ; (1-%z)^2,  %pi}
A1  =
[1x1 boolean   ]  [1x1 string  ]
[1x1 polynomial]  [1x1 constant]

--> A2 = {%s^2, gda(); %F, list(-5, "hello")}
A2  =
[1x1 polynomial]  [1x1 handle]
[1x1 boolean   ]  [    list  ]

--> cat(3, A1, A2)
ans  =
(:,:,1)
[1x1 boolean   ]  [1x1 string  ]
[1x1 polynomial]  [1x1 constant]

(:,:,2)
[1x1 polynomial]  [1x1 handle]
[1x1 boolean   ]  [    list  ]
```

### 参照

• brackets [..] — Concatenation. Recipients of an assignment. Results of a function
• lstcat — リストの結合
• permute — permutes the dimensions of an array
• matrix — ベクトルまたは行列を異なる大きさの行列に成形する