Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


dpb
Posts:
9,253
Registered:
6/7/07


Fortran FORMATcompatible i/o functions in Matlab?
Posted:
Aug 27, 2013 10:18 AM


It comes up over and over and over...problems in i/o (mostly input, but output would have benefits as well) where the C format string rules just don't fit realworld applications well.
Two of the most typical cases have again been here the last week of soone a case of a fixedwidth field and the second a case where the input file to be scanned used exponential notation w/o the explicit 'e' that is a value like 2.398.
Both forms are valid in Fortran and handled cleanly therein but both require machinations to deal with in Matlab owing to the limitations in the way C format strings are defined and the scanning rules imposed by C.
I have proposed in the (fairly distant now) past that there should be a set of i/o routines that allow Fortran FORMAT syntax for i/o in Matlab that would resolve these problems as well as another convenience of being able to write repeat specifiers instead of the buttugly repmat() workaround in current Matlab code. Unfortunately, at that time my support expired and from then on TMW seemed to not even accept bug reports or enhancement requests so after a while I gave it up. I did build a personal mex library that did take a FORMAT string and call a Fortran routine that did the work and returned variables but it
a) was somewhat limited being designed for a certain subclass of specific problems, and
b) in the move back to the farm from last consulting gig it appears that I failed to get the source code for it off the machine where it existed and I've not had the time nor inclination to rebuild it.
The question here is, is there any other traction out there that would engender support for such a feature request if a cadre were to develop such a case statement and outline for same?
I'm on the downhill side; I'll never write any more Matlab code "in anger"; poking around here at cssm and on some farm production data and other things of passing interest (like wind farm capacity factor data compared to wind data) is the most I'll do going forward but it would certainly be a very useful addendum in the arsenal for those still doing serious work and those to come.

I'm asking here i



