help-octave
[Top][All Lists]
Advanced

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

Re: io format specifier question


From: Carlo de Falco
Subject: Re: io format specifier question
Date: Tue, 1 Jul 2008 20:17:02 +0100


On 01/lug/08, at 19:24, A. Kalten wrote:

On Tue, 1 Jul 2008 20:02:36 +0200
"marco restelli" <address@hidden> wrote:

  I need to read an ASCII file containing floating point numbers as

0.112977-141

which stands for 0.112977E-141 (i.e., the E is omitted). The point is,
fscanf(fp,'%e') treats this as two numbers


If you're on a unix system, just do:

sed s/-/e-/ file > file-new

This will convert all "0.112977-141" to "0.112977e-141"

AK

I am afraid that would mess up with negative numbers...
Try:

sed 's/\([0-9]*.[0-9]*\)\([-+]\)/\1e\2/' filename > newfilename

this asumes you have one number per row...
anyway, if it is easy to read this format in fortran, you can easily
wrap a small fortran program in a DLD function to call it from octave.

c.

P.S. Ciao Marco :)




reply via email to

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