removefimath
fi
オブジェクトからの fimath オブジェクトの削除
説明
例
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
設定が関数の外部から影響を受けないようにすることができます。このパターンは生成コードでデータのコピーを作成しません。
function y = fixed_point_32bit_KeepLSB_plus_example(a,b) f = fimath('OverflowAction','Wrap',... 'RoundingMethod','Floor',... 'SumMode','KeepLSB',... 'SumWordLength',32); a = setfimath(a,f); b = setfimath(b,f); y = a + b; y = removefimath(y); end
MATLAB® Coder™ 製品をお持ちの場合、C コードを生成できます。この例では、32 ビットのネイティブ整数型をもつコンピューターで C コードを生成します。
a = fi(0,1,16,15); b = fi(0,1,16,15); codegen -config:lib fixed_point_32bit_KeepLSB_plus_example... -args {a,b} -launchreport
int fixed_point_32bit_KeepLSB_plus_example(short a, short b) { return a + b; }
入力引数
出力引数
拡張機能
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)