MATLAB: Need help using textscan to import file

textscan

Hello all, I have a doc file that has a 10 line header that I do not need imported to matlab. Following these lines, I have numerical values I need imported that are separated by commas and a double colon. I would like them to be imported as a matrix stored in a single variable –> # of rows by 14 columns. The format looks like this:
130578547943024301,93,82.1882,87.2253,7168.89,261.738,194.983::130578547943024301,136,85.3604,94.8827,8099.22,386.447,173.988
130578547943180589,95,81.0533,87.1715,7065.54,262.06,196.035::130578547943180589,134,93.5194,102.914,9624.42,389,173
….. and so on. The commas and colon essentially play the same role and are both delimiters separating the data.
For example I'd like the final output to be store in variable A which is a 1250×14 matrix.
Thanks in advance!

Best Answer

A=cell2mat(textscan(fid,'%f','headerlines',10, ...
'multipledelimsasone',1, ...
'delimiters',',:', ...
'collectoutput',1));
Use fopen to return a valid file handle fid first, of course...