How to use format spec to read in Textscan?

6 visualizaciones (últimos 30 días)
Pappu Murthy
Pappu Murthy el 18 de Sept. de 2019
Respondida: Star Strider el 18 de Sept. de 2019
I have a string '-2.554-4'. This when I read using textscan I get two numbers -2.554 and -4. However it should be actually -2.554e-4. How do I read it that way

Respuesta aceptada

Star Strider
Star Strider el 18 de Sept. de 2019
I doubt you can insert the ‘e’ as part of the data.
One option:
x = sscanf('-2.554-4','%f')
y = x(1).*10^x(2)
producing:
x =
-2.5540
-4.0000
y =
-2.5540e-04
Make appropriate changes to work with your data.

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data 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