简体   繁体   中英

read scientific number missing e delimiters in matlab

Could someone help in reading the following data format in matlab?

GRID 7 -.0091 .19725 .067776

GRID 8 .0011 .19725 .067776

GRID 9 -.004 .19725 .027776

GRID* 4998 .086001 .206

  • 7.5-4

GRID* 4999 .086001 0.

  • 7.5-4

GRID* 5000 .151999 .206

  • 7.5-4

GRID* 5001 0. 1.-6

  • 7.5-4

GRID* 5002 .151999 0.

  • 7.5-4

GRID* 5003 0. .206001

  • 7.5-4

GRID 1000016 -.0082 .019249 .127546

the problem is the numbers in the format like 7.5-4 that should have formatted as 7.5e-4 and that matlab doesnot recognized as floating point delimiters %f

for the moment I am using the folowing command line=textscan(firstLine,'%s %u %u %f %f')

that is not getting the strange scientific format

thanks in advance

Use the format %f%f which reads in mantissa and exponent individually:

[a]=textscan('7.5-4','%f%f')
a{1}.*10.^a{2}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM