Problem converting double to char usin char

조회 수: 28 (최근 30일)
Johan
Johan 2012년 6월 20일
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