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

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by