numerictype
固定小数点または浮動小数点のデータ型を記述する embedded.numerictype
オブジェクトの構成
構文
説明
T = numerictype
は既定の numerictype
オブジェクトを作成します。
T = numerictype(
は、勾配とバイアスのスケーリング、符号プロパティ値 s
,w
,slopeadjustmentfactor
,fixedexponent
,bias
)s
、語長 w
、slopeadjustmentfactor
、bias
の固定小数点 numerictype
オブジェクトを作成します。
T = numerictype(___,
では、名前と値のペアを使用してプロパティを設定できます。値を指定しないプロパティについては、いずれも既定値が割り当てられます。Name,Value
)
T = numerictype(T1,
では、既存の Name,Value
)numerictype
オブジェクト T
のコピー T1
を作成し、いずれかまたはすべてのプロパティ値を変更できます。
T = numerictype('Double')
は double データ型の numerictype
オブジェクトを作成します。
T = numerictype('Single')
は single データ型の numerictype
オブジェクトを作成します。
T = numerictype('Half')
は half データ型の numerictype
オブジェクトを作成します。
T = numerictype('Boolean')
は boolean データ型の numerictype
オブジェクトを作成します。
例
既定の numerictype
オブジェクトの作成
この例では、既定のプロパティ設定で numerictype
オブジェクトを作成する方法を示します。
T = numerictype
T = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 15
既定の語長とスケーリングをもつ numerictype
オブジェクトの作成
この例では、語長の引数 w
と小数部の長さの引数 f
を省略して既定の語長とスケーリングをもつ numerictype
オブジェクトを作成する方法を示します。
T = numerictype(1)
T = DataTypeMode: Fixed-point: unspecified scaling Signedness: Signed WordLength: 16
このオブジェクトは符号付きで、語長は 16 ビット、スケーリングは未指定です。
符号属性の引数 s
を使用して符号なしの numerictype
オブジェクトを作成できます。
T = numerictype(0)
T = DataTypeMode: Fixed-point: unspecified scaling Signedness: Unsigned WordLength: 16
このオブジェクトは、語長は既定の 16 ビット、スケーリングは未指定です。
スケーリングが未指定の numerictype
オブジェクトの作成
この例では、小数部の長さの引数 f
を省略してスケーリングが未指定の numerictype
オブジェクトを作成する方法を示します。
T = numerictype(1,32)
T = DataTypeMode: Fixed-point: unspecified scaling Signedness: Signed WordLength: 32
このオブジェクトは符号付きで、語長は 32 ビットです。
指定した語長と小数部の長さをもつ numerictype
オブジェクトの作成
この例では、2 進小数点スケーリング、語長 32 ビット、小数部の長さ 30 ビットの符号付き numerictype
オブジェクトを作成する方法を示します。
T = numerictype(1,32,30)
T = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 30
勾配とバイアスのスケーリングによる numerictype
オブジェクトの作成
この例では、勾配とバイアスのスケーリングを使用した numerictype
オブジェクトを作成する方法を示します。勾配とバイアスでスケーリングされた数値の実際値は以下で表されます。
語長 16 ビット、勾配 2^-2、バイアス 4 の符号付き固定小数点データ型を記述する numerictype
オブジェクトを作成します。
T = numerictype(1,16,2^-2,4)
T = DataTypeMode: Fixed-point: slope and bias scaling Signedness: Signed WordLength: 16 Slope: 0.25 Bias: 4
勾配は以下で表すこともできます。
語長 16 ビット、勾配調整係数 1、固定小数点の指数 -2、バイアス 4 の符号付き固定小数点データ型を記述する numerictype
オブジェクトを作成します。
T = numerictype(1,16,1,-2,4)
T = DataTypeMode: Fixed-point: slope and bias scaling Signedness: Signed WordLength: 16 Slope: 0.25 Bias: 4
指定したプロパティ値をもつ numerictype
オブジェクトの作成
この例では、numerictype
オブジェクトの作成時に名前と値のペアを使用してプロパティを設定する方法を示します。
T = numerictype('Signed',true,... 'DataTypeMode',... 'Fixed-point: slope and bias scaling', ... 'WordLength',32,... 'Slope',2^-2,... 'Bias',4)
T = DataTypeMode: Fixed-point: slope and bias scaling Signedness: Signed WordLength: 32 Slope: 0.25 Bias: 4
符号が未指定の numerictype
オブジェクトの作成
この例では、名前と値のペアを使用して Signedness
プロパティを Auto
に設定することで符号が未指定の numerictype
オブジェクトを作成する方法を示します。
T = numerictype('Signedness','Auto')
T = DataTypeMode: Fixed-point: binary point scaling Signedness: Auto WordLength: 16 FractionLength: 15
指定したデータ型の numerictype
オブジェクトの作成
この例では、引数および名前と値のペアを使用して特定のデータ型の numerictype
オブジェクトを作成する方法を示します。
T = numerictype(0,24,12,'DataType','ScaledDouble')
T = DataTypeMode: Scaled double: binary point scaling Signedness: Unsigned WordLength: 24 FractionLength: 12
返される numerictype
オブジェクト T
は符号なしで、語長は 24 ビット、小数部の長さは 12 ビット、データ型はスケーリングされた double に設定されます。
double、single、half、または boolean の numerictype
オブジェクトの作成
この例では、データ型をオブジェクトの作成時点で double、single、half、または boolean に設定して numerictype
オブジェクトを作成する方法を示します。
データ型モードを double に設定して numerictype
オブジェクトを作成します。
T = numerictype('Double')
T = DataTypeMode: Double
データ型モードを single に設定して numerictype
オブジェクトを作成します。
T = numerictype('Single')
T = DataTypeMode: Single
データ型モードを half に設定して numerictype
オブジェクトを作成します。
T = numerictype('Half')
T = DataTypeMode: Half
データ型モードを boolean に設定して numerictype
オブジェクトを作成します。
T = numerictype('Boolean')
T = DataTypeMode: Boolean
入力引数
s
— オブジェクトが符号付きであるかどうか
true
または 1
(既定値) | false
または 0
オブジェクトが符号付きであるかどうか。数値または logical の 1
(true
) または 0
(false
) として指定します。
例: T = numerictype(true)
データ型: logical
w
— 語長
16
(既定値) | 正の整数
格納整数値の語長 (ビット単位)。正の整数として指定します。
例: T = numerictype(true,16)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
f
— 小数部の長さ
15
(既定値) | integer
格納整数値の小数部の長さ (ビット単位)。整数として指定します。
小数部の長さが語長より大きくてもかまいません。詳細については、2 進小数点の解釈(Fixed-Point Designer) を参照してください。
例: T = numerictype(true,16,15)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
slope
— 勾配
3.0518e-05
(既定値) | ゼロより大きい有限の浮動小数点数
勾配。ゼロより大きい有限の浮動小数点数として指定します。
勾配とバイアスで固定小数点数のスケーリングが決まります。
メモ
これらのプロパティの 1 つを変更すると、他のプロパティに影響を与えます。
例: T = numerictype(true,16,2^-2,4)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
bias
— オブジェクトに関連付けられるバイアス
0
(既定値) | 浮動小数点数
オブジェクトに関連付けられるバイアス。浮動小数点数として指定します。
勾配とバイアスで固定小数点数のスケーリングが決まります。
例: T = numerictype(true,16,2^-2,4)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
slopeadjustmentfactor
— 勾配調整係数。
1
(既定値) | 正のスカラー
勾配調整係数。正のスカラーとして指定します。
勾配調整係数は 1 以上かつ 2 未満でなければなりません。この範囲外の slopeadjustmentfactor
を入力すると、numerictype
オブジェクトは自動的に slopeadjustmentfactor
および fixedexponent
の値にスケーリングの正規化を適用して、修正後の勾配調整係数が 1 以上かつ 2 未満になるようにし、勾配の値を維持します。
勾配調整は、固定小数点数の小数部の勾配と同義です。
メモ
これらのプロパティの 1 つを変更すると、他のプロパティに影響を与えます。
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
fixedexponent
— 固定小数点指数
-15
(既定値) | integer
オブジェクトに関連付けられる固定小数点指数。整数として指定します。
メモ
FixedExponent
プロパティは、FractionLength
の負の値です。1 つのプロパティを変更すると、他のプロパティも変更されます。
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
名前と値の引数
引数のオプションのペアを Name1=Value1,...,NameN=ValueN
として指定します。Name
は引数名、Value
は対応する値です。名前と値の引数は他の引数の後に表示されなければなりませんが、ペアの順序は重要ではありません。
R2021a より前は、名前と値をそれぞれコンマを使って区切り、Name
を引用符で囲みます。
例: F = numerictype('DataTypeMode','Fixed-point: binary point scaling','DataTypeOverride','Inherit')
メモ
名前と値のペアを使用して numerictype
オブジェクトを作成する場合、Fixed-Point Designer™ は既定の numerictype
オブジェクトを作成してから、コンストラクターで指定された各プロパティ名に対して対応する値を割り当てます。この動作は、T = numerictype(s,w)
などの構文を使用したときの動作とは異なります。例: プロパティ名とプロパティ値のペアによる numerictype オブジェクトの作成を参照してください。
Bias
— バイアス
0
(既定値) | 浮動小数点数
バイアス。浮動小数点数として指定します。
勾配とバイアスで固定小数点数のスケーリングが決まります。
例: T = numerictype('DataTypeMode','Fixed-point: slope and bias scaling','Bias',4)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
DataType
— データ型カテゴリ
'Fixed'
(既定値) | 'Boolean'
| 'Double'
| 'ScaledDouble'
| 'Single'
| 'Half'
データ型カテゴリ。次の値のいずれかとして指定します。
'Fixed'
– 固定小数点または整数のデータ型'Boolean'
– MATLAB® の組み込みの boolean データ型'Double'
– MATLAB の組み込みの double データ型'ScaledDouble'
– スケーリングされた double データ型'Single'
– MATLAB の組み込みの single データ型'Half'
– MATLAB の半精度データ型
例: T = numerictype('Double')
データ型: char
DataTypeMode
— データ型とスケーリング モード
'Fixed-point: binary point scaling'
(既定値) | 'Fixed-point: slope and bias scaling'
| 'Fixed-point: unspecified scaling'
| 'Scaled double: binary point scaling'
| 'Scaled double: slope and bias scaling'
| 'Scaled double: unspecified scaling'
| 'Double'
| 'Single'
| 'Half'
| 'Boolean'
オブジェクトに関連付けられるデータ型とスケーリング モード。次の値のいずれかとして指定します。
'Fixed-point: binary point scaling'
– スケーリングが語長と小数部の長さにより定義される固定小数点データ型'Fixed-point: slope and bias scaling'
– スケーリングが勾配とバイアスにより定義される固定小数点データ型'Fixed-point: unspecified scaling'
– スケーリングが未指定の固定小数点データ型'Scaled double: binary point scaling'
– 固定小数点の語長と小数部の長さの情報が保持される double データ型'Scaled double: slope and bias scaling'
– 固定小数点の勾配とバイアスの情報が保持される double データ型'Scaled double: unspecified scaling'
– 固定小数点のスケーリングが未指定の double データ型'Double'
– 組み込みのdouble
'Single'
– 組み込みのsingle
'Half'
– MATLAB の半精度データ型'Boolean'
– 組み込みのboolean
例: T = numerictype('DataTypeMode','Fixed-point: binary point scaling')
データ型: char
DataTypeOverride
— データ型オーバーライドの設定
'Inherit' (既定値) | 'Off'
データ型オーバーライドの設定。次の値のいずれかとして指定します。
'Inherit'
–DataTypeOverride
をオンにします。'Off'
–DataTypeOverride
をオフにします。
メモ
DataTypeOverride
プロパティは、値が既定の 'Inherit'
に設定されている場合は表示されません。
例: T = numerictype('DataTypeOverride','Off')
データ型: char
FixedExponent
— 固定小数点指数
-15
(既定値) | integer
オブジェクトに関連付けられる固定小数点指数。整数として指定します。
メモ
FixedExponent
プロパティは、FractionLength
の負の値です。1 つのプロパティを変更すると、他のプロパティも変更されます。
例: T = numerictype('FixedExponent',-12)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
FractionLength
— 格納整数値の小数部の長さ
最高精度 (既定値) | integer
格納整数値の小数部の長さ (ビット単位)。整数として指定します。
既定値は、オブジェクトの値と語長に基づく最高精度の小数部の長さです。
例: T = numerictype('FractionLength',12)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Scaling
— 固定小数点のスケーリング モード
'BinaryPoint'
(既定値) | 'SlopeBias'
| 'Unspecified'
オブジェクトの固定小数点のスケーリング モード。次の値のいずれかとして指定します。
'BinaryPoint'
–numerictype
オブジェクトのスケーリングは、小数部の長さにより定義されます。'SlopeBias'
–numerictype
オブジェクトのスケーリングは、勾配およびバイアスにより定義されます。'Unspecified'
– 最高精度の 2 進小数点スケーリングの自動割り当てのためにnumerictype
オブジェクトの作成時にのみ許容される一時的な設定です。
例: T = numerictype('Scaling','BinaryPoint')
データ型: char
Signed
— オブジェクトが符号付きであるかどうかの指定
true
または 1
(既定値) | false
または 0
オブジェクトが符号付きであるかどうか。数値または logical の 1
(true
) または 0
(false
) として指定します。
メモ
Signed
プロパティは引き続きサポートされていますが、numerictype
オブジェクトの表示には常に Signedness
プロパティが表示されます。Signed
プロパティを使用して numerictype
オブジェクトの符号属性の変更または設定を選択すると、MATLAB は Signedness
プロパティの対応する値を更新します。
例: T = numerictype('Signed',true)
データ型: logical
Signedness
— オブジェクトが符号付きであるかどうかの指定
'Signed'
(既定値) | 'Unsigned'
| 'Auto'
オブジェクトが符号付きであるかどうか。次の値のいずれかとして指定します。
'Signed'
– 符号付き'Unsigned'
– 符号なし'Auto'
– 符号の指定なし
メモ
符号が未指定 (Signedness: Auto
) の numerictype
オブジェクトを作成できますが、固定小数点 numerictype
オブジェクトの Signedness
はすべて Signed
または Unsigned
でなければなりません。Signedness: Auto
をもつ numerictype
オブジェクトが numerictype
オブジェクトの作成に使用された場合、numerictype
オブジェクトの Signedness
プロパティは自動的に既定値の Signed
になります。
例: T = numerictype('Signedness','Signed')
データ型: char
Slope
— 勾配
3.0518e-05
(既定値) | 有限の正の浮動小数点数
勾配。有限の正の浮動小数点数として指定します。
勾配とバイアスで固定小数点数のスケーリングが決まります。
メモ
これらのプロパティの 1 つを変更すると、他のプロパティに影響を与えます。
例: T = numerictype('DataTypeMode','Fixed-point: slope and bias scaling','Slope',2^-2)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
SlopeAdjustmentFactor
— 勾配調整係数。
1
(既定値) | 正のスカラー
勾配調整係数。正のスカラーとして指定します。
勾配調整係数は 1 以上かつ 2 未満でなければなりません。この範囲外の slopeadjustmentfactor
を入力すると、numerictype
オブジェクトは自動的に slopeadjustmentfactor
および fixedexponent
の値にスケーリングの正規化を適用して、修正後の勾配調整係数が 1 以上かつ 2 未満になるようにし、勾配の値を維持します。
勾配調整は、固定小数点数の小数部の勾配と同義です。
メモ
これらのプロパティの 1 つを変更すると、他のプロパティに影響を与えます。
例: T = numerictype('DataTypeMode','Fixed-point: slope and bias scaling','SlopeAdjustmentFactor',1.5)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
WordLength
— 格納整数値の語長
16
(既定値) | 正の整数
格納整数値の語長 (ビット単位)。正の整数として指定します。
例: T = numerictype('WordLength',16)
データ型: half
| single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
使用に関するメモと制限:
Simulink® から MATLAB Function ブロックに読み込まれる固定小数点信号は、信号のデータ型とスケーリング情報が入力される
numerictype
オブジェクトに割り当てられます。入力が固定小数点信号以外の場合はデータ型を返します。
生成されるコードで
numerictype
オブジェクトを作成するのに使用します。データ型に関連するすべての
numerictype
オブジェクト プロパティは定数でなければなりません。
HDL コード生成
HDL Coder™ を使用して FPGA 設計および ASIC 設計のための Verilog および VHDL のコードを生成します。
バージョン履歴
R2006a より前に導入R2021a: fi
、fimath
、numerictype
オブジェクトのあいまいなプロパティ名はサポートされない
以前のリリースでは、fi
、fimath
、numerictype
オブジェクトのあいまいなプロパティに対して警告が表示されていました。R2021a では、あいまいなプロパティ名のサポートは削除されています。代わりに正確なプロパティ名を使用してください。
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)