MATLAB: What’s wrong with textscan syntax

continue stringtextscan

I am converting some OCTAVE code to MATLAB and am running into what I assume is a sytnax error with the textscan function:
fid = fopen(FileName);
RawData = textscan(fid,'%q,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f'...
'%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f','Headerline',1,'Delimiter',',');
fclose(fid);
ERROR:
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
syntax error. To construct matrices, use brackets instead of parentheses.
I have tried adding a comma before the continued string on the third line:
,'%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f','Headerline',1,'Delimiter',',');
ERROR:
Error using textscan
Name-value pair arguments must come in pairs.
Which to me means the comma should not be there, as it is picking that up as the start of a name-value pair.
I have looked up examples, but cannot find why I am getting an error.

Best Answer

Try an alternate format descriptor:
fd = ['%q' repmat('%f', 1, 28)];
RawData = textscan(fid, fd, 'HeaderLines',1, 'Delimiter',',');
I believe I counted correctly. It would be best to check that.