MATLAB: DLMREAD gives error from fields it should ignore

dlmread error mistmatch range numeric string field

trialdata = dlmread(filename,'\t',[1 0 1000 13]);
trialdata(:,2) = []; % second column seems to have a zero-indexed trial number, remove it
trialdata(:,1) = trialdata(:,1) - min(trialdata(:,1));
trialdata(:,1) = trialdata(:,1) * 1000;
trialdata = [zeros(size(trialdata,1),1)+trialno trialdata];
I have the code above for reading from the file but I get the error :
Error using dlmread (line 147)
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 255, field number 15) ==> time trialcursorx cursory hand_x hand_Y rotation
step targetangle targetposx targetposy garagelocation garageposx garageposy \n
Error in GUIpreparation (line 39)
trialdata = dlmread(filename,'\t',[1 0 1000 13]);
I understand the error but why is it even looking at field 15 in the first place? shouldn't it just be ignored?

Best Answer

Historically dlmread required all data in the file to be numeric. That changed a couple of years ago. Now, text header rows can be skipped without problem, and left text columns can be skipped without problem. However, all other columns must be numeric, even if they are going to be skipped.
You will probably need to switch to using textscan() or readtable()