Hello,
I am looking for a format such that:
fprintf( format , 1.1111111); gives 1.11
fprintf( format , 11.111111); gives 11.1
fprintf( format , 111.11111); gives 111
That is 3 digits in total regadless of the decimal point, thanks!

 Respuesta aceptada

Más respuestas (1)

Sara Boznik
Sara Boznik el 21 de Ag. de 2020

0 votos

Hi
I suggest you that you use:
fprintf('%.3g',1.111111)

Categorías

Más información sobre MATLAB Mobile en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Preguntada:

J T
el 21 de Ag. de 2020

Respondida:

el 21 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by