How to use format spec to read in Textscan?

조회 수: 6 (최근 30일)
Pappu Murthy
Pappu Murthy 2019년 9월 18일
답변: Star Strider 2019년 9월 18일
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

채택된 답변

Star Strider
Star Strider 2019년 9월 18일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by