


brede_read_txtlines - Read file with text lines
function C = brede_read_txtlines(filename, 'PropertyName',
'PropertyValue')
Input: filename Filename with ASCII
Property: Info [ {0} | An integer ] Amount of
feedback/debug information
Method [ {fgetl} | fread ] Method to read the
file.
Process [ {deblank} | none ] Option for processing
the trailing whitespaces of each
line. Deblank will ignore them.
Output: C Cell of strings
This function read a text file. Each line in the text is
returned as a string in a cell with the lines in rows.
Empty lines that contain just a line shift are also
returned. The line shift character is not returned.
An empty file will return an empty cell string.
By default the fgetl matlab function is used to read the lines in
the file. This may be slow since no preallocation is used. If
'method' = 'fread' is used then preallocation is used and the
reading will be faster, but all combination of line breaks are
not implemented, so if is safer to use 'method' = 'fgetl'.
Example:
s = sprintf('5\n5\n');
f=fopen('tmp.txt','w');fwrite(f, s);fclose(f);
t = brede_read_txtlines('tmp.txt')
t = brede_read_txtlines('tmp.txt', 'info', 6, 'method', 'fread')
See also BREDE, BREDE_READ, BREDE_READ_TXTMATRIX, BREDE_STR.
$Id: brede_read_txtlines.m,v 1.15 2008/05/15 09:53:50 fn Exp $