num to uint8 output, How to as=num, uint8 output

1 回表示 (過去 30 日間)
dmfwlansejr
dmfwlansejr 2021 年 7 月 15 日
回答済み: Steven Lord 2021 年 7 月 15 日
>> 0x10
ans =
uint8
16
>> as=10;
>> 0xas <-This is an Error
How too make output uint8 16
Variable 'as' must be used!
  1 件のコメント
Peter O
Peter O 2021 年 7 月 15 日
Use an explicit cast?
as = uint8(16)
as = uint8 16

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

採用された回答

Steven Lord
Steven Lord 2021 年 7 月 15 日
as = 10;
y = uint8(hex2dec(string(as)))
y = uint8 16
That 0x followed by hex digits syntax is for defining literals, much like you'd type:
q = 1e4
q = 10000
r = 3+4i
r = 3.0000 + 4.0000i
It cannot be used with variables.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by