Problem converting double to char usin char

47 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2012-6-20
sprintf('%g', Value)
or
num2str(Value)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by