0001 function output=labRead(labFile)
0002
0003
0004
0005
0006 if nargin<1, selfdemo; return; end
0007
0008 labFile='drum.lab';
0009 contents = textread(labFile,'%s','delimiter','\n','whitespace','');
0010 output=[];
0011 for i=1:length(contents)
0012
0013 line=contents{i};
0014 items=split(line, 9);
0015 drumName=items{1};
0016
0017 timePoint=split(items{2}, 32);
0018 segmentNum=length(timePoint)/2;
0019 temp=[];
0020 for j=1:segmentNum
0021 temp.segment(j).begin=eval(timePoint{2*j-1});
0022 temp.segment(j).end=eval(timePoint{2*j});
0023 end
0024 output=setfield(output, {1}, drumName, {1}, temp);
0025 end
0026
0027
0028 function selfdemo
0029 labFile='drum.lab';
0030 output=feval(mfilename, labFile);
0031 disp(output);