moving decimal places to the left

6 次查看(过去 30 天)
Karen Landeros
Karen Landeros 2020-9-2
编辑: ROL 2020-9-2
hello!
super simple question lol
how do I turn my answer from:
1.0 into .1 ?
So yes, how do I move the decimal place to left. No matter what I try with sprintf nothing seems to work

回答(1 个)

ROL
ROL 2020-9-2
编辑:ROL 2020-9-2
If the 1.0 is stored as a char/string, you can do this:
sprintf("%0.1f",str2double("1.0")/10)
If the leading zero is not required, you can always trim this away - sprintf does not support this:
sprintf("%.1f",str2double("1.0")/10).extractAfter("0")

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by