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: 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 ]
Nathaniel

Posts: 2
Registered: 6/24/13
Re: textscan with precision random NaN
Posted: Jun 24, 2013 11:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"someone" wrote in message <kq9o1b$29a$1@newscl01ah.mathworks.com>...
> "Nathaniel" wrote in message <kq9lo8$oja$1@newscl01ah.mathworks.com>...
> > I am reading in a set of data using the textscan function. This was working perfectly ... until I added precision. Now it reads in all the data correctly, but also reads in NaN values between some of the lines. So, if the data were:
> > 1
> > 2
> > 3
> > 4
> > 5
> >
> > it might be read in as
> >
> > 1
> > 2
> > 3
> > NaN
> > 4
> > NaN
> > 5
> >
> > Still investigating if there is a pattern in the NaN placement, but does anyone have any leads? Thank you for your time.

>
> Based on the information you provided, its going to take a lot of guessing to give you any kind of an answer.
>
> Can you provide sniplets of your code befor and after?
> What does the input data look like?
> How did you "add precision" to textscan?


Good point, sorry, this is my first time on a forum.
I'm using this for text scan

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



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.