format short, format long, format short E, format long E, format rat

36 visualizaciones (últimos 30 días)
Opariuc Andrei
Opariuc Andrei el 28 de Oct. de 2020
Editada: Rik el 28 de Oct. de 2020
How can i represent a number let's say 1231312.1232323 with the formats long/short/long e /short e /rat more elegant or in a single code line without having to write 10 colums i was thinking of the fprintf and format spec commands . P.S i'm very much a beginner in matlab :) .

Respuesta aceptada

Rik el 28 de Oct. de 2020
For a single value I would suggest the fprintf function:
  4 comentarios
Rik el 28 de Oct. de 2020
Maybe it is just that I prefer having full control by using fprintf or sprintf, and I don't see the benefit of spamming the command window with the same value in different formats.
But at least you have an example here of how you can convert one syntax for format to another, and how you can use any object array in a for loop, which will then be processed column by column.

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Loops and Conditional Statements en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by