×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Precision with sscanf!

Precision with sscanf!

Precision with sscanf!

(OP)
Hello!

I have the following problem with the sscanf command.
The doubles of the following line should be read out:

 S='   1.000000E+00 G     -3.374722E-05      2.751758E-05      1.076888E-03       8'

If i use the following command:

A=sscanf(S,'%f %c %f %f %f %f')'

I get:

A =

    1.0000   71.0000   -0.0000    0.0000    0.0011    8.0000


My doubles get cut off. sscanf doesn't get all of the information.
If i use: A=sscanf(S,'%.16f %c %.16f %.16f %.16f %.16f')' i get nothing!
But if i use this syntax for sprintf, it works, why not with sscanf.

Does someone has a hint for me!

Thanks in advance!
Georg

RE: Precision with sscanf!

Have you tried using e instead of f?

RE: Precision with sscanf!

(OP)
Hi!

Yes, I have! But the problem seems to be a option for display, because if i calculate with them, the result is o.k. So it is saved proper, but not displayed. Funny!

As long as the results are o.k, I do not mind!

Greets

RE: Precision with sscanf!

(OP)
For all, who have the same problem:
Look at the helpdesk. Seek for the format command. Thats the way how to change the display-accuracy!

Greets

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources