Is a construct like this legal?
It doen't return any error, but the "file position indicator" is not advanced as it should. I read a text file CRLF for new line.
fid = fopen( ... ); str = fgetl( fid ); cac = textscan( fid, ... ); ... str = fgetl( fid ); cac = textscan( fid, ... ); fclose( fid )
That series is valid, yes.
Did you open the file with 'rt' instead of 'r' in order to account for the CRLF ?
Also note that if you use a count for textscan() then the file position will be left after the last format code is used, before the newline for that line (unless the end of format matches newline)