简体   繁体   English

在 matlab 中读取缺少 e 分隔符的科学数

[英]read scientific number missing e delimiters in matlab

Could someone help in reading the following data format in matlab?有人可以帮助阅读matlab中的以下数据格式吗?

GRID 7 -.0091 .19725 .067776网格 7 -.0091 .19725 .067776

GRID 8 .0011 .19725 .067776网格 8 .0011 .19725 .067776

GRID 9 -.004 .19725 .027776网格 9 -.004 .19725 .027776

GRID* 4998 .086001 .206网格* 4998 .086001 .206

  • 7.5-4 7.5-4

GRID* 4999 .086001 0.网格 * 4999 .086001 0。

  • 7.5-4 7.5-4

GRID* 5000 .151999 .206网格* 5000 .151999 .206

  • 7.5-4 7.5-4

GRID* 5001 0. 1.-6网格* 5001 0. 1.-6

  • 7.5-4 7.5-4

GRID* 5002 .151999 0.网格 * 5002 .151999 0。

  • 7.5-4 7.5-4

GRID* 5003 0. .206001网格* 5003 0. .206001

  • 7.5-4 7.5-4

GRID 1000016 -.0082 .019249 .127546网格 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问题是像 7.5-4 这样格式的数字应该被格式化为 7.5e-4 并且 matlab 不能识别为浮点分隔符 %f

for the moment I am using the folowing command line=textscan(firstLine,'%s %u %u %f %f')目前我正在使用以下命令行=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:使用格式%f%f分别读取尾数和指数:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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