Borrar filtros
Borrar filtros

moving decimal places to the left

7 visualizaciones (últimos 30 días)
Karen Landeros
Karen Landeros el 2 de Sept. de 2020
Editada: ROL el 2 de Sept. de 2020
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

Respuestas (1)

ROL
ROL el 2 de Sept. de 2020
Editada: ROL el 2 de Sept. de 2020
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")

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by