get character value from decimal

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by