removefimath
fimath
を fi
オブジェクトから削除する
説明
例
fi オブジェクトからの fimath オブジェクトの削除
この例では、fi
オブジェクトおよび fimath オブジェクトの定義方法、fi
オブジェクトへの fimath
オブジェクトの付加方法および付加された fimath
オブジェクトの削除方法を説明します。
a = fi(pi)
a = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13
f = fimath('RoundingMethod','Floor','OverflowAction','Wrap'); a = setfimath(a,f)
a = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 RoundingMethod: Floor OverflowAction: Wrap ProductMode: FullPrecision SumMode: FullPrecision
b = removefimath(a)
b = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13
コード生成での fimath
の設定と削除
この例では、パターン X = setfimath(X,F)
と Y = removefimath(Y)
を使用して、変数の fimath
設定が関数の外部から影響を受けないようにする方法を示します。このパターンは生成コードでデータのコピーを作成しません。
type fixed_point_32bit_KeepLSB_plus_example.m
function y = fixed_point_32bit_KeepLSB_plus_example(a,b) f = fimath('RoundingMethod', 'Floor', ... 'OverflowAction', 'Wrap', ... 'SumMode', 'KeepLSB', ... 'SumWordLength', 32) a = setfimath(a,f); b = setfimath(b,f); y = a + b; y = removefimath(y); end
a = fi(0,1,16,15); b = fi(0,1,16,15);
MATLAB® Coder™ を使用して C コードを生成できます。この例では、32 ビットのネイティブ整数型をもつコンピューターで C コードを生成します。
codegen -config:lib fixed_point_32bit_KeepLSB_plus_example... -args {a,b} -launchreport Code generation successful: View report
コード生成レポートでコードをトレースします。
入力引数
x
— 入力データ
スカラー | ベクトル | 行列 | 多次元配列
データ型と値を出力にコピーする元の入力データ。スカラー、ベクトル、行列または多次元配列として指定します。入力 x
が fi
オブジェクトでない場合、y = x
となります。
データ型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fi
複素数のサポート: あり
出力引数
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
バージョン履歴
R2012b で導入
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)