The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: textscan with precision random NaN
Replies: 3   Last Post: Jun 24, 2013 12:01 PM

Advanced Search

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

Posts: 9,850
Registered: 6/7/07
Re: textscan with precision random NaN
Posted: Jun 24, 2013 12:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/24/2013 10:45 AM, Nathaniel wrote:
> fid = fopen(DataPath{1});
> data = textscan(fid, '%d64 %s %*s %*f %*f %*f %*f %*f %.15f %.15f',
> 'Delimiter', '\t', 'headerlines', 1);
> structData= cell2struct(data, {'Points', 'Person', 'Allocation','SD'}, 2);
> Before adding in the .15 I would be reading in 2880ish lines but after
> adding it in I'm reading in 3400ish - the difference being made up of NaN
> Input data is an edr.txt file

What's the point and are the input data actually in that format? I'm
guessing not based on your description of the symptoms. On input there
should be no need for the precision; the %f is sufficient to handle any
legitimately-formed floating point value on its own. That said _IF_
(the proverbial "big if") the data are formatted that way, then it
should work (and I think, theoretically it should anyways as explicit
decimal points and exponents, etc., should override the format
specification, but why make it more difficult than needs be?

Again, as Nasser points out, it's crystal-orb time w/o any data to look at.


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.