From help-octave-request at che dot utexas dot edu Thu Aug 25 09:35:55 1994 Subject: Re: [Q] Skipping input From: "John C. Campbell" To: help-octave Date: Thu, 25 Aug 1994 09:35:53 +22305450 chris at astri dot uni dot torun dot pl (Krzysztof Gozdziewski) writes... | I have following problem: I want to read data from text file. The file | is organized in such a wy, that in its first two lines there is some | description, next are some lines with numbers, next two lines | of comments, numbers, comments, etc. This is a common question and the answer (aside from using sed or awk outside of Octave) is to use the C-style IO functions. These functions are completely flexible yet tedious to use. If you are processing lots of data files with the same format then the overhead (your time spend coding) will be much smaller than if you have to parse each data file differently. I wrote some code that would use 'fgets' to get a string from a file, then I used 'sscanf' to scan that string for strings and numbers. The use of these functions (sscanf, fscanf, scanf, gets, printf, sprintf, fprintf, getc, fseek, ftell, frewind, etc) is well documented in Octave but you could also use your favorite C book to get the flavor of these functions. John -------- John C. Campbell : jcc at che dot utexas dot edu : University of Texas-Austin : Dept. of Chemical Engineering :