get character value from decimal

2 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2017 年 3 月 3 日
回答済み: Walter Roberson 2017 年 3 月 3 日
get character value from decimal
rbi = (dec2bin(rb,1))';
rbin = reshape(rbi,siz,8);
txt = (bin2dec(rbin))';
txt is decimal value needs its character... tried
char(txt) still incorrect result
  1 件のコメント
Adam
Adam 2017 年 3 月 3 日
編集済み: Adam 2017 年 3 月 3 日
What is rb (and siz) and what does 'not working' mean exactly? Error? Incorrect result?

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

採用された回答

Walter Roberson
Walter Roberson 2017 年 3 月 3 日
txt = char( (bin2dec(rbin))' );

その他の回答 (1 件)

Adam
Adam 2017 年 3 月 3 日
編集済み: Adam 2017 年 3 月 3 日
You should use
doc num2str
to convert a number to a string/char. Using direct casting will just give you whatever the Unicode or ASCII value is for your given value

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by