Too many digit numbers in MATLAB strings?

1 visualización (últimos 30 días)
Steven
Steven el 6 de Feb. de 2014
Comentada: Walter Roberson el 6 de Feb. de 2014
Hi
I am using strings in a format like:
sprintf('image-%f-%d.jpeg'),i,j)
but it writes the files for me in long digits, for the first one! I mean the output is:
image-14.000000-2
How can I fix this? I just want something like: image-14-2
and why does it so?
Thanks so much
Steven

Respuesta aceptada

Walter Roberson
Walter Roberson el 6 de Feb. de 2014
sprintf('image-%d-%d.jpeg',i,j)
  2 comentarios
Steven
Steven el 6 de Feb. de 2014
Thanks Walter!
But what is the difference? I want to understand why and how it works.
Thanks so much again.
Steven
Walter Roberson
Walter Roberson el 6 de Feb. de 2014
%d displays integral values. %f displays fixed-point values.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by