Reading a large csv datafile with multiple lines of headerinfo into Matlab -


does have advice how read comma separated data file matlab? simple solutions (like dlmread, fscanf) not seem work, there multiple (10) lines of header information. closest got solution is:

c=textscan(datafile) g=cell2mat(c{1,1}(34:endoffile)}) //34 line data starts v=str2num(g) 

the problem here data instance looks this:

;1.0345,937,18,763 ;1.0355,947,4,652 etc. 

when converting matrix strings in cell have of same size, otherwise error using 'vertcat' given. if no other option, delete header in lets notepad, many many files tedious job.

dlmread accepts starting row/column parameters, or alternatively range parameter. if data starts on line 10, try

v = dlmread(datafile, '', 9, 0); 

if prefer textscan, can specify number of headerlines skip:

v = textscan(datafile, ..., 'headerlines', 10, ...); 

scan down "user configurable options" on documentation page more details.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -