io format specifier question

A. Kalten akalten at comcast.net
Tue Jul 1 13:24:59 CDT 2008


On Tue, 1 Jul 2008 20:02:36 +0200
"marco restelli" <mrestelli at gmail.com> 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



More information about the Help-octave mailing list