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 日

1 投票

txt = char( (bin2dec(rbin))' );

その他の回答 (1 件)

Adam
Adam 2017 年 3 月 3 日
編集済み: Adam 2017 年 3 月 3 日

0 投票

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

カテゴリ

ヘルプ センター および File Exchange で Characters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by