On Thursday, June 20, 2013 8:06:42 AM UTC+12, dpb wrote: > On 6/19/2013 2:36 PM, Kristin wrote: > > ... > > > > OK, here's a very rough, not terribly user=friendly outline, but should > > get the job done... > > > > program tentoeleven > > character(len=132):: fold, fnew ! A filename for old, new file > > real :: v(8) ! Data array of 8 floats > > > > read(*,*) fold ! It'll wait for you... > > open(11,file=fold,action='read',status='old') > > > > read(*,*) fnew ! It'll wait for you... > > open(12,file=fnew,action='write',status='new') > > > > ios=0 > > do while(ios.eq.0) > > read(11,'(F10.4)',iostat=ios) v ! read the old file F10.4 > > write(12,'(F11.4)') v ! F11.4 will insert space delimiter > > end do > > > > close(11) > > close(12) > > end > > > > Will continue 'til EOF condition on the old file at which time the > > IOSTATUS variable will become <0. Of course, other errors will also > > abort, but one presumes the files are otherwise, clean. > > > > --
Here's an alternative that can be run within Matlab using: dos(['tentoeleven ' infile ' ' outfile]) where infile and outfile are strings with the filenames.
program tentoeleven character(len=132):: fold, fnew ! A filename for old, new file real :: v(8) ! Data array of 8 floats integer :: na ! No of args on command line integer :: ios ! Error code for read
na=iargc() if(na < 2)stop 'Must specify infile and outfile on command line' call getarg(1,fold) call getarg(2,fnew)