ヘルプ センターヘルプ センター
数値を文字配列に変換
s = num2str(A)
s = num2str(A,precision)
s = num2str(A,formatSpec)
例
s = num2str(A) は fi オブジェクト A を文字配列表現に変換します。この出力が関数 eval への入力に最適なのは、eval(s) が元の fi オブジェクトと完全に同じものを作成するためです。
s
A
fi
eval
eval(s)
s = num2str(A,precision) は、precision によって指定された精度の桁数を使用して、fi オブジェクト A を文字配列表現に変換します。
precision
s = num2str(A,formatSpec) は、formatSpec で指定した形式を A の全要素に適用します。
formatSpec
すべて折りたたむ
fi オブジェクト A を作成し、文字ベクトルに変換します。
A = fi(pi)
A = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13
S = num2str(A)
S = '3.1416'
fi オブジェクトを作成し、8 桁の精度で文字ベクトルに変換します。
S = num2str(A,8)
S = '3.1416016'
入力配列。数値配列として指定します。
データ型: fi | double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical 複素数のサポート: あり
double
single
int8
int16
int32
int64
uint8
uint16
uint32
uint64
logical
出力文字列の有効桁数の最大値。正の整数として指定します。
データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
出力フィールドの書式。書式演算子を使用して指定します。formatSpec には通常のテキストおよび特殊文字を含めることもできます。
書式演算子の詳細については、MATLAB® ドキュメンテーションの num2str のリファレンス ページを参照してください。
num2str
入力配列のテキスト表現。文字配列として返されます。
R2016a で導入
num2str | mat2str | tostring
mat2str
tostring
次の 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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office