sir, I want to convert hex string to hex, and convert to int16.

 採用された回答

dpb
dpb 2015 年 11 月 19 日

0 投票

>> int16(hex2dec('f'))
ans =
15
>> whos ans
Name Size Bytes Class Attributes
ans 1x1 2 int16
>>
There must be more to the question???

その他の回答 (1 件)

Guillaume
Guillaume 2015 年 11 月 19 日
編集済み: Guillaume 2015 年 11 月 19 日

1 投票

The simplest way to stop you going crazy is simply to look in the documentation. Under Matlab -> Language fundamentals -> Data Type -> Data Type conversion you'll find the documentation for hex2dec.
d = uint16(hex2dec('2A5F'))
Also have a look at converting string to numeric.

2 件のコメント

KiJun Baek
KiJun Baek 2015 年 11 月 19 日
thank you for your answer!
dpb
dpb 2015 年 11 月 19 日
_"...look in the documentation. Under Matlab -> Language fundamentals -> Data Type -> Data Type conversion..."
Also for OP that is seemingly almost totally unknown any longer is
>> lookfor hex
dec2hex - Convert decimal integer to hexadecimal string.
hex2dec - Convert hexadecimal string to decimal integer.
hex2num - Convert IEEE hexadecimal string to double precision number.
num2hex - Convert singles and doubles to IEEE hexadecimal strings.
>>
when one has a subject area but not sure of the function name actually looking for...

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

タグ

質問済み:

2015 年 11 月 19 日

コメント済み:

dpb
2015 年 11 月 19 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by