Thread Subject: fscanf / NaN

Subject: fscanf / NaN

From: Holger

Date: 2 Apr, 2008 12:23:02

Message: 1 of 2

Hallo,

I am reading a data from a file with...

databank=fscanf(fid,'%g');

But if the file contains NaN's, it is running on an error
and stops reading the file.

How could I avoid that ?

Thank you,
Holger

Subject: fscanf / NaN

From: Abel Brown

Date: 2 Apr, 2008 13:07:03

Message: 2 of 2

"Holger " <holger-1978@gmx.de> wrote in message
<fsvtr6$dnl$1@fred.mathworks.com>...
> Hallo,
>
> I am reading a data from a file with...
>
> databank=fscanf(fid,'%g');
>
> But if the file contains NaN's, it is running on an error
> and stops reading the file.
>
> How could I avoid that ?
>
> Thank you,
> Holger


Give "textscan" a whirl instead of fscanf. You shouldn't
have any problem with nans then ...

abel

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fscanf textscan... Abel Brown 2 Apr, 2008 09:10:15
nan Holger 2 Apr, 2008 08:25:06
fscanf Holger 2 Apr, 2008 08:25:06
rssFeed for this Thread

Contact us at files@mathworks.com