shiftdata
指定した次元で演算するためのデータ シフト
構文
[x,perm,nshifts] = shiftdata(x,dim)
説明
[x,perm,nshifts] = shiftdata(x,dim)
はデータ x
をシフトして、組み込み関数 filter
と同じ置換を使用し、次元 dim
が 1 列目になるように並べ替えます。ベクトル perm
は使用した置換ベクトルを返します。
dim
がないか空の場合、大きさが 1 でない最初の次元が 1 列目にシフトされ、シフト数が nshifts
で返されます。
shiftdata
は、データを元の形状に戻す unshiftdata
とともに使用します。これらの関数は、filter
、goertzel
、sgolayfilt
、sosfilt
のように、特定の次元を操作する関数を作成する場合に役立ちます。
例
例 1
3 行 3 列の魔方陣を作成します。
x = fi(magic(3))
x = 8 1 6 3 5 7 4 9 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 11
行列
x
をシフトし、2 次元方向に操作します。[x,perm,nshifts] = shiftdata(x,2)
x = 8 3 4 1 5 9 6 7 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 11 perm = 2 1 nshifts = []
置換ベクトル
perm
とシフト数nshifts
がシフトされた行列x
とともに返されます。この行列を元の形状に戻します。
y = unshiftdata(x,perm,nshifts)
y = 8 1 6 3 5 7 4 9 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 11
例 2
x
を行ベクトルとして定義します。x = 1:5
x = 1 2 3 4 5
dim
を空に定義し、x
の大きさが 1 でない最初の次元を 1 列目にシフトします。[x,perm,nshifts] = shiftdata(x,[])
x = 1 2 3 4 5 perm = [] nshifts = 1
x
が列ベクトルとして返され、置換ベクトルperm
とシフト数nshifts
も返されます。unshiftdata
を使用して、x
を元の形状に戻します。y = unshiftdata(x,perm,nshifts)
y = 1 2 3 4 5
バージョン履歴
R2008a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)