help-octave
[Top][All Lists]
Advanced

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

Re: Loading ASCII data files quickly


From: Torsten Lange
Subject: Re: Loading ASCII data files quickly
Date: Mon, 10 Aug 2009 16:58:02 +0200
User-agent: KMail/1.10.3 (Linux/2.6.27.25-0.1-default; KDE/4.1.3; x86_64; ; )

Hi Mathias,

if you don't need to extract e.g. the time from the headers you may - as a 
simple work around - add  a comment to the header lines using sed by system 
call before you read the files using load()? This usually is my approach. 
Sorry, I don't have much expertise in octave's capabilities to do these jobs.

Torsten

Am Montag, 10. August 2009 16:24:07 schrieb Matthias Brennwald:
> Dear all
>
> I've got a few data files with a short header followed by two colums
> of data (see example below). The header data is marked by '*' signs,
> like this:
>
> ------------------------------
> * TMD data written by MATAA on 10-Aug-2009 15:37:39
> * MSW, 0 deg., no filter
> 0     -6.49888e-08
> 1.04167e-05   -1.77097e-07
> 2.08333e-05   2.53872e-07
> 3.125e-05     9.02216e-07
> 4.16667e-05   1.13457e-06
> 5.20833e-05   6.72286e-07
> 6.25e-05      -1.5686e-07
> 7.29167e-05   -6.71451e-07
> 8.33333e-05   -5.46739e-07
> 9.375e-05     -7.39792e-08
> 0.000104167   1.52549e-07
> 0.000114583   -9.41797e-08
> .
> .
> .
> ------------------------------
>
> I tried to read line by line using fgetl(...) into a string. If the
> line starts with an '*', it is treated as header line. Otherwise it is
> transformed into numbers using str2num(...). This line-by-line
> procedure works, but is too slow for large files. I believe it would
> be much more efficient to read only the header lines using this
> method, and then use a file command that loads the rest of the data in
> one step. Any hints or ideas how I can do this?
>
> Matthias
>
>
> ----
> Matthias Brennwald, Käferholzstrasse 173, CH-8046 Zürich, +41 44 364
> 17 03
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave




reply via email to

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