io format specifier question

A. Kalten akalten at comcast.net
Tue Jul 1 15:31:23 CDT 2008


On Tue, 1 Jul 2008 21:37:38 +0200
"marco restelli" <mrestelli at gmail.com> wrote:

> 
> Still I wonder whether there is a format descriptor in octave which
> can handle this without preprocessing. The reason why I am insisting
> is that all the home made preprocessing 1) tends to make the data
> processing cumbersome when many files/people/systems are involved and
> 2) is likely to produce wrong results in various corner cases, which
> might be standard in some sense (in my case, according to the FORTRAN
> standard), but which I fail to take into account.
> 

Sorry about all the posts, but I'm still learning about octave myself.

There could some function somewhere to read Fortran data, but I
wouldn't know.

However, the octave regexprep() string function should work.  Just
read the data into string s and convert with:

regexprep(s,'([0-9])([+-])','$1e$2')

Then convert back to a double value with str2double()

The regular expressions can be modified to accommodate any
data variation.

This seems the simplest solution.

AK



More information about the Help-octave mailing list