MATLAB: Does the TEXTREAD function not read any empty fields at the end of a file within MATLAB

delimiteremptyendfieldfieldsfilelastlineMATLABtabtextread

Why does the TEXTREAD function not read any empty fields at the end of a file within MATLAB?
My text file has several lines or rows of data containing a specific number of fields (groups of characters or numbers, that could, for instance, be tab delimited). When the last few fields at the end of my file are empty, the TEXTREAD function does not read them.
For example, I have a file called myfile.txt which contains three fields. I use TEXTREAD to read from the file, as follows:
[a, b, c] = textread('myfile.txt','%s %s %s ','delimiter','\t');
length(a)
length(b)
length(c)
If the last line of myfile.txt contains empty values for the second and third fields, then TEXTREAD does not assign them to variables "b" and "c".

Best Answer

This has been verified as a bug in MATLAB 6.5.1 (R13SP1) in the way that the TEXTREAD function reads empty fields from a file.
Currently, to work around this issue, please insert a line break at the end of your file by pressing the "RETURN" or "ENTER" key.