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

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

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

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

matrix

ベクトルまたは行列を異なる大きさの行列に成形する

呼び出し手順

y = matrix(v, m, n)
y = matrix(v, m1, m2, m3, ..)
y = matrix(v, [sizes])

引数

v

ベクトル, 行列またはハイパー行列

n, m, m1, m2, ..

整数

sizes

整数ベクトル

y

ベクトル, 行列またはハイパー行列

説明

n x m個のエントリを有する ベクトルまたは行列の場合, コマンド y=matrix(v,n,m) または同様な y=matrix(v,[n,m])v ベクトル(または行列)を, vのエントリを列方向でスタックすることにより nxm の行列に変換します.

m または nの次元の一つが -1 に等しい場合,もう一つの次元で size(v,'*')を割った数が自動的に代入されます.

prod(size(v))==prod(sizes)のようなハイパー行列の場合, コマンド y=matrix(v,sizes) (または 等価な y=matrix(v,n1,n2,...nm)) は, vのエントリを "列方向"(つまり,最初の次元が最初に変わる)にスタックする ことによりv を行列またはハイパー行列に変換します. y=matrix(v,sizes) は,sizes がスカラーまたは2要素のベクトルの場合,通常の行列となります.

  • y = v(:) is equivalent to matrix(v,-1, 1)
  • matrix() can be overloaded for any mlist() type, with a function named %<type>_matrix(v,s,..) with at least 2 input arguments.

With a regular matrix of decimal numbers:

a = [1 3 5 7 9 11; 2 4 6 8 10 12]
matrix(a, 4, 3)
matrix(a, [3 4])
matrix(a, 3, -1)
// into an hypermatrix:
matrix(a, 3, 2, 2)

With texts:

t = strsplit("a":"x",1:23)'
matrix(t,[3,8])
--> t = strsplit("a":"x",1:23)'
 t  =
!a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  !

--> matrix(t,[3,8])
 ans  =
!a  d  g  j  m  p  s  v  !
!b  e  h  k  n  q  t  w  !
!c  f  i  l  o  r  u  x  !

With a cells hyperarray:

c = makecell([2,3,2], %t,%z, %i,"abc", list(%pi,"a"), int8(23),cos,sind,"àèìòù",corelib, 0.5, 1/%z^2)
rc = matrix(c, 3, 4)
rc(8)==c(8)
rc{8}.getshell
 c  =
(:,:,1)
  [1x1 boolean]  [1x1 polynomial]  [1x1 constant]
  [1x1 string ]  [    list      ]  [1x1 int8    ]
(:,:,2)
  [      1 fptr   ]  [      1 function]  [1x1 string]
  [        library]  [    1x1 constant]  [    r     ]

--> rc = matrix(c, 3, 4)
 rc  =
  [1x1 boolean   ]  [    list    ]  [      1 fptr    ]  [1x1 constant]
  [1x1 string    ]  [1x1 constant]  [        library ]  [1x1 string  ]
  [1x1 polynomial]  [1x1 int8    ]  [      1 function]  [    r       ]

--> rc(8)==c(8)
 ans  =
  T

--> rc{8}.getshell
 ans  =
 cmd

With a structures array:

clear s
s(3,6).r = %pi
matrix(s,2,9)
--> s(3,6).r = %pi
 s  =
  3x6 struct array with fields:
    r

--> matrix(s,2,9)
 ans  =
  2x9 struct array with fields:
    r

参照

  • colon (:) — コロン演算子
  • resize_matrix — 行列またはハイパー行列をトリムまたは拡張(およびキャスト)
  • ndims — 配列の次元の数
  • size — オブジェクトの大きさ
  • extraction — 行列およびリストのエントリの展開
  • transposition — (') 転置演算子, 文字列デリミタ
  • brackets [..] — Concatenation. Recipients of an assignment. Results of a function
  • matrices — Scilab オブジェクト, Scilabの行列
  • hypermatrices — Scilab オブジェクト, Scilabの N 次元行列
  • makecell — セル配列を作成.
  • struct — Builds a structure or an array of structures
  • mlist — Scilab オブジェクト, 型付リスト定義に向いた行列.
Report an issue
<< flipdim matrixmanipulation permute >>

Copyright (c) 2022-2023 (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:
Mon Jan 03 14:37:48 CET 2022