How to define the format of number such as D22.12 or D19.12?

조회 수: 1 (최근 30일)
Kun-Chi Wang
Kun-Chi Wang 2019년 7월 30일
댓글: Guillaume 2019년 7월 30일
I am studying a code in which a text is read like this one.
0.740000000000D+02 0.640625000000D+01 0.427553523606D-08-0.146805323186D+01
They are processed by the following code:
[IODE Crs delta_n M0] = parsef(current_line, {'D22.12' 'D19.12' 'D19.12' 'D19.12'});
where function "parsef" is defined as:
function varargout = parsef(input, format)
global input_
input_ = input;
varargout = getvals(1, format, 1);
clear global input_
return
After being processed by the above code, the result is
"IODE = 74, Crs = 6.40625, delta_n = 4.27553523606e-09 ,M0 = -1.46805323186," which is the same as the text that I want to read.
The question is that there is another text I wnat to read, which is as shown:
6.100000000000E+01-2.409687500000E+02 3.192632985979E-09 1.224491866258E-01
They are processed by the same code mentioned above.
The result is
"IODE = 6.1, Crs = 1, delta_n = 2, M0 = 9," which is not exactly the same as the text that I want to read.
I guess the problem is the definition of format in the code:
{'D22.12' 'D19.12' 'D19.12' 'D19.12'}
However, I don't really understand what {'D22.12' 'D19.12' 'D19.12' 'D19.12'} means, not to mention to revise them.
Does anyone have suggestions or resources that I can refer to?
  댓글 수: 1
Guillaume
Guillaume 2019년 7월 30일
We would need the code for getvals
Have you tried replacing the D by E in that format cell array passed to parsef?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by