From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: read numerical text file by fixed column width, no delimiters
Date: Wed, 19 Jun 2013 15:06:42 -0500
Organization: NNTP Server
Lines: 31
Message-ID: <kpt30e$928$>
References: <kpo59r$4ra$> <kpq7fb$i95$> <kpt17b$ie3$>
NNTP-Posting-Host: jy+QfeYoQFMk8Or4YOj/
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: comp.soft-sys.matlab:797834

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...

   read(*,*) fnew                   ! It'll wait for you...

   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


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.