help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading tab-delimited ASCII files


From: Matthias Brennwald
Subject: Re: Reading tab-delimited ASCII files
Date: Wed, 08 Aug 2007 09:09:08 +0200
User-agent: Icedove 1.5.0.12 (X11/20070607)


Date: Tue, 7 Aug 2007 21:14:54 -0700 (PDT)
From: address@hidden
Subject: Re: Reading tab-delimited ASCII files
To: "James Sherman Jr." <address@hidden>
Cc: Matthias Brennwald <address@hidden>,
        address@hidden
Message-ID:
        <address@hidden>
Content-Type: text/plain;charset=iso-8859-1


  Hi all,

maybe you can strip your data from the first 2 columns, substitute the N/A for
NaN, save the result in a temp file and load that temp file?  As in the
following code (for unix system)

   ## Make data octave-readable
   system (["perl -w -p -e 's/.*?\t.*?\t//; s|N/A||ig' < ",your_file_name, "> 
/tmp/some_safe_temp_file_name.txt"]);

   ## Read it
   your_data = load ("/tmp/some_safe_temp_file_name.txt")

   ## let's be good and clean up
   unlink ("/tmp/some_safe_temp_file_name.txt")

(in production code, you'd want to use a temp name returned by tmpnam()).

  Hth,

  Etienne

Yes, I could do that. But then my program will rely on the existence of the tools required to re-format the data files (e.g. perl in your example), and the program will also have to call different commands on different operating systems... that sound like asking for problems to me. I therefore prefer to do it using Octave commands only.

Matthias


reply via email to

[Prev in Thread] Current Thread [Next in Thread]