Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Elementary Functions > matrixmanipulation > cat

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

スカラー, ベクトル, 行列またはセル配列, yA1,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 — ベクトルまたは行列を異なる大きさの行列に成形する
Report an issue
<< Shape tests matrixmanipulation flipdim >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:02:06 CET 2019