Problem converting double to char usin char

37 visualizzazioni (ultimi 30 giorni)
Hi! I'm trying to convert a double-variable to a char-variable using char but i all ends up with: >> Value=5; char(Value)
ans =
>> whos ans Name Size Bytes Class Attributes
ans 1x1 2 char
how do I get ans=5 with Class char?
Best Regards
Johan

Risposta accettata

Walter Roberson
Walter Roberson il 20 Giu 2012
sprintf('%g', Value)
or
num2str(Value)

Più risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by