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 2025.0.0. This page might be outdated.
See the recommended documentation of this function

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

flipdim

指定した次元に沿って x ブロック要素を反転

呼び出し手順

y = flipdim(x, dim)
y = flipdim(x, dim, blockSize)

引数

x, y

ベクトル、行列、または任意の通常のデータ型のハイパーマトリックスを含む、 or cells array. yxのサイズを取得します.

dim

positive integer : index of the dimension / direction of x along which the order of x components must be inverted.

blockSize

a positive integer, sub-multiple of size(x,dim): number of rows, of columns, of pages etc in each block. Default value = 1

説明

flipdim(x, 1) inverts the order of rows of x.

flipdim(x, 2) inverts the order of columns of x.

flipdim(x, 3) inverts the order of pages of x. Etc.

The optional parameter blockSize allows splitting x in size(x,1)/blockSize blocks of blockSize rows (dim=1), or in size(x,2)/blockSize blocks of blockSize columns (dim=2), etc (dim>2) and to invert their order. In each block, the order of components (rows, columns, pages etc) is unchanged.

// 例 1: x の要素を最初の次元に沿って反転
x = [1 2 3 4; 5 6 7 8];
y = flipdim(x, 1)

// 例2: x の要素を2番目の次元に沿って反転
y = flipdim(x, 2)

// 例3: x の要素を3番目の次元に沿って反転
x = matrix(1:48,[3 2,4,2]);
y = flipdim(x, 3)

// 例4: 最初の例を複素数に
x = [1+%i 2*%i 3 4; 5 6-%i 7 8*%pi*%i]
y = flipdim(x, 1)

// 整数エンコードされた数値
x = int16(grand(4, 3, 2, "uin", -9, 9))
y = flipdim(x, 1)

// 論理値:
x = (grand(3, 4, "uin", -9, 9) > 0)
y = flipdim(x, 2)

// テキスト:
x = matrix(strsplit("a":"x", 1:23), 4, 6);
x = x+x
flipdim(x, 2)

// 多項式:
x = inv_coeff(grand(3, 9, "uin", 0, 3), 2)
flipdim(x, 1)

// 有理数:
n = inv_coeff(grand(3, 9, "uin", 0, 3), 2);
d = inv_coeff(grand(3, 9, "uin", 0, 3), 2);
r = n./d
flipdim(r, 2)

blockSizeの使用例 :

X = [0 1 2 3 4 5 6 7 8 9 10 11];
flipdim(X, 2, 2) // => [10 11   8 9   6 7   4 5   2 3   0 1] // ブロックサイズ = 2.
flipdim(X, 2, 3) // => [9 10 11   6 7 8   3 4 5   0 1 2]
flipdim(X, 2, 4) // => [8 9 10 11   4 5 6 7   0 1 2 3]
flipdim(X, 2, 6) // => [6 7 8 9 10 11   0 1 2 3 4 5]
// blockSizeがxの指定した次元を分割しない場合はエラー.
y = flipdim(x, 2, 5); // size(X) = [1 12] および blockSize=5 は 12を割り切れない.

Example of results:

--> x
 x  =
 -5 -2  0  9
  0 -7 -6  9
 -1 -8 -7  8

--> flipdim(x, 1)
 ans  =
 -1 -8 -7  8
  0 -7 -6  9
 -5 -2  0  9

--> flipdim(x, 2)
 ans  =
  9  0 -2 -5
  9 -6 -7  0
  8 -7 -8 -1

--> x
 x  =
(:,:,1)
  9  4 -3
 -4 -8 -3

(:,:,2)
  5  8  9
  4  4  9

--> flipdim(x, 3)
 ans  =
(:,:,1)
  5  8  9
  4  4  9

(:,:,2)
  9  4 -3
 -4 -8 -3

--> x
 x  =
 -2  3 -5  9 -4 -8
  2  8  4 -9  6 -6
 -9  8  3  4 -3  4

--> flipdim(x, 2, 2)
 ans  =
 -4 -8 -5  9 -2  3
  6 -6  4 -9  2  8
 -3  4  3  4 -9  8

--> flipdim(x, 2, 3)
 ans  =
  9 -4 -8 -2  3 -5
 -9  6 -6  2  8  4
  4 -3  4 -9  8  3

参照

  • circshift — circularly shifts elements or subarrays of an array (regular, of structures, cells, custom)
  • fftshift — fft出力を再配置し,スペクトルの中心に周波数0を移動する
  • ifftshift — fftshiftを反転する
  • colon — コロン演算子

履歴

バージョン記述
5.5.0 10進数から任意の型に拡張: 論理値, 整数, 文字列, 多項式および有理数. xブロック毎に反転するために, 新しい入力引数 blockSizeが追加されました.
Report an issue
<< circshift matrixmanipulation matrix >>

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:
Mon Jan 03 14:37:48 CET 2022