help-octave
[Top][All Lists]
Advanced

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

Re: load textfile with header


From: Avraham Rosenberg
Subject: Re: load textfile with header
Date: Mon, 8 Mar 2004 08:06:42 +0200 (IST)

You do not mention what is your system.
In a Unix/linux system it is very easy to get rid of the non-numeric data
by using sed. You can do it either outside octave (using a for loop as you
mention that that you have hundreds of such files) or inside by using the
system command:

system("cat file_name | sed -n '/[0-9]/p'| sed 's/[  ]//g' >tmpfile")
followed by array_name=load()"file_name");

In the second sed command, which is probably not necessary, the two
characters in the square brackets are space and tab.
Good luck, Avraham

On Sun, 7 Mar 2004, albert treblataf wrote:

> Date: Sun, 7 Mar 2004 11:28:20 -0800 (PST)
> From: albert treblataf <address@hidden>
> To: address@hidden
> Subject: load textfile with header
> Resent-Date: Sun, 7 Mar 2004 13:28:29 -0600
> Resent-From: address@hidden
>
> Hello,
>
> Is there a way to import a.txt file into Octave that has a header before the 
> data?
> I would like to run an mfile that will loopimporting hundreds of these files, 
> processing the data and then saving the results. I don't need the header 
> information, just the data.
> Thetext files look like this:
>
> Transfer Function
>
> X Axis Units = Hz
> Y Axis Units = dB
>
> Freq,TFAB
>         +0,+0.703162
> +1.34583,+0.002317
> +2.69165,+0.011234
> +4.03748,+0.184732
> +5.38331,+0.034276
> etc
>
> Any helpis greatly appreciated
>
> Best regards
>
> Albert
>
>
>
>
>
> Albert
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster.
>
>




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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