MATLAB: Dlmread reading outside of range

dlmread

Hello all,
I am trying to read a file like the following:
1 0 100 0.0 -100 .5 10 10
2 1 200 0.5 -100 .5 10
3 2 300 1.0 -100 .5 10 *
4 3 400 1.5 -100 .5 10 *
but I only want columns 2 – 7, so I have a loop for the dlmread with the parameters
num(k,:)=dlmread(FullFileNames(j,:),'',[count(j,1)+4+k 1 count(j,1)+4+k 6]);
where it goes row by row. I get the error
??? Error using ==> dlmread at 145
Mismatch between file and format string.
Trouble reading number from file (row 1, field 8) ==> * \n
Error in ==> DragTestGUI>run_button_Callback at 284
num(k,:)=dlmread(FullFileNames(j,:),'',range);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> DragTestGUI at 44
gui_mainfcn(gui_State, varargin{:});
Error in ==>
guidemfile>@(hObject,eventdata)DragTestGUI('run_button_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Which means it is reading one row beyond what I want it to. Any ideas on how to fix this?
FYI: the code is running under a GUI, hence the last part of the error.

Best Answer

dlmread() can only be used for pure numeric data. Use textscan() instead.