Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

ReadList of Data containing "nan"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32798] ReadList of Data containing "nan"
  • From: Adalbert Hanssen <hanssen at zeiss.de>
  • Date: Tue, 12 Feb 2002 06:23:54 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, MathGroup,

from a measuring instrument, I get an tab-delimited ASCII file of records, each consisting of five numbers.

Up to now, I used to read those records like this (I deliberately skip the first two lines):

       fil=OpenRead[fileName];
       liste={};				(* start with an empty list *)
       Read[fil,String];		(* skip the first and the   *)
       str=Read[fil,String];		(* second line in the file  *)
       While[(str=Read[fil,String])=!=EndOfFile
            ,strstr=StringToStream[str];
             zeile=ReadList[strstr, Real, WordSeparators->{"\t"}];
             Close[strstr];
             liste=Append[liste,zeile];
            ];
      Close[fil];
      (* now liste contains all the data from the file *)

This works fine for me. Now I am getting results, which have lines, where one or more of the numbers in a line are "nan" because of an out-off-range condition of the measuring instrument. I want to read those lines nevertheless, but I want the "nan"-items be represented by Indeterminate in Mathematica.

Which is the best way to read all the data simultaneously converting the figures "nan" to Indeterminate in Mathematica?


kind regards

Dipl.-Math. Adalbert Hanszen


  • Prev by Date: Re: Matrices
  • Next by Date: Generate expression from result
  • Previous by thread: Re: Understanding the Output
  • Next by thread: RE: ReadList of Data containing "nan"