get character value from decimal

2 visualizaciones (últimos 30 días)
Elysi Cochin
Elysi Cochin el 3 de Mzo. de 2017
Respondida: Walter Roberson el 3 de Mzo. de 2017
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 comentario
Adam
Adam el 3 de Mzo. de 2017
Editada: Adam el 3 de Mzo. de 2017
What is rb (and siz) and what does 'not working' mean exactly? Error? Incorrect result?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 3 de Mzo. de 2017
txt = char( (bin2dec(rbin))' );

Más respuestas (1)

Adam
Adam el 3 de Mzo. de 2017
Editada: Adam el 3 de Mzo. de 2017
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

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by