I was hoping someone might be able to help me with reading in a file with textscan (or some other function in Matlab). The documentation and examples online have been no help to me and I guess I am missing something intuitive 🙁 Here is what the structure of the file I want to read in looks like:
ID, Date of ID, C 1-1, C 1-2, M R3, M R4, Glob ID Settings
TPOL_430_412_10X, 5/5/2011 20:23, 0, 0, 0, 0, -1, 5.00_5.00_3_300.00_3_0.00
TPOL_430_412_10X, 5/5/2011 20:23, 0, 0, 0, 0, -1, 5.00_5.00_3_300.00_3_0.00
TPOL_430_412_10X, 5/5/2011 20:23, 0, 0, 1, 0, 1, 5.00_5.00_3_300.00_3_0.00
TPOL_430_412_10X, 5/5/2011 20:23 0, 0, 0, 0, -1, 5.00_5.00_3_300.00_3_0.00
TPOL_430_412_10X, 5/5/2011 20:23 0, 0, 0, 0, -1, 5.00_5.00_3_300.00_3_0.00
Where my file is a .csv file so the delimiter is a comma. What I have been trying to no avail is the following:
fmt = [repmat('%s',1,2), repmat('%f',1,5),'%*s %[^\n]'];
fid = fopen('file.csv','rt');
data = textscan(fid, fmt, 'HeaderLines', 1);
fclose(fid);
Any suggestions greatly appreciated!
I used this
it should split all the parameters you want to read into a cell
Awith size(1,9).Hope this helps.