필터 지우기
필터 지우기

How to insert a degree symbol in matlab using input function?

조회 수: 39 (최근 30일)
Nghi Lam
Nghi Lam 2020년 4월 9일
댓글: Star Strider 2020년 4월 10일
I'm trying to inser a degree symbol in my input but I have tried char(), ^{\circ}, and none of them works.
For example, my input is:
a = input('If your initial temperature is 25... C, then what is your final temperature? ');
the space in between 25 and C indicates the degree symbol but I don't know how to insert it. Please help :/
Thank you

채택된 답변

Star Strider
Star Strider 2020년 4월 9일
I would just use ALT+0176. I did that here and it seems to work:
a = input('If your initial temperature is 25° C, then what is your final temperature? ');
Another option:
inpstr = sprintf('If your initial temperature is 25%c C, then what is your final temperature? ', char(0176));
a = input(inpstr)
Both of these workd when I ran them (R2020a).
  댓글 수: 2
Nghi Lam
Nghi Lam 2020년 4월 10일
it works! Thank you so much
Star Strider
Star Strider 2020년 4월 10일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by