Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Using textscan with exponential notation
Replies: 2   Last Post: Aug 7, 2014 11:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Connor Pyles

Posts: 4
Registered: 8/4/14
Using textscan with exponential notation
Posted: Aug 4, 2014 1:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

If I have a line of text formatted as follows:

3.3225254e+01 -4.4877079e+01 -4.6426502e+01

How can I use textscan() to pull these numbers out with the same precision?

I've read the text as a string into the variable coord_row, and I've tried this

coord_row = textscan(coord_row,'%f %f %f');

I end up with less precision than I am looking for. I've also tried

coord_row = textscan(A{i},'%9.7f %9.7f %9.7f');

Which lops off the exponential notation.

I want to end up doing some math to the coordinates, and writing back to a file with the same format and precision as the original coordinates I read in. Any help would be greatly appreciated.

Thanks,
Connor



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.