fmt = repmat('%s', 1, 31);
[...
To control the maximum number of characters per column, or to show an error if the file is not compatible, use
InputLines = textread(filename, '[^\n]', 'delimiter', '\n');
and then parse the strings in InputLines yourself. This would satisfy the literal requirement to use textread() but still give you full flexibility about how you interpret the input.
Best Answer