Home > asr > mlfRead.m

mlfRead

PURPOSE ^

mlfRead: Read an MLF file

SYNOPSIS ^

function labVec=mlfRead(mlfFile)

DESCRIPTION ^

 mlfRead: Read an MLF file
    Usage: labVec=mlfRead(mlfFile)

    For example:
        mlfFile='japan20.syl.mlf';
        labVec=mlfRead(mlfFile)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function labVec=mlfRead(mlfFile)
0002 % mlfRead: Read an MLF file
0003 %    Usage: labVec=mlfRead(mlfFile)
0004 %
0005 %    For example:
0006 %        mlfFile='japan20.syl.mlf';
0007 %        labVec=mlfRead(mlfFile)
0008 
0009 %    Roger Jang, 20070916
0010 
0011 fid=fopen(mlfFile);
0012 tline = fgetl(fid);
0013 if ~strcmp(tline, '#!MLF!#')
0014     fprintf('The first line of %s is not #!MLF!#!\n', mlfFile);
0015     error('Wrong format!');
0016 end
0017 
0018 i=0;
0019 while 1
0020     tline = fgetl(fid);
0021     if ~ischar(tline), break, end
0022     fileName=sscanf(tline(1:end-1), '"*/%s');    % tline='"*/f_B001_00001.lab"'
0023     if ~isempty(fileName)
0024         i=i+1;
0025         labVec(i).fileName=fileName;
0026         labVec(i).syl=[];
0027         continue;
0028     end 
0029     if strcmp(tline, '.')
0030         continue;
0031     end
0032     labVec(i).syl{end+1}=tline;
0033 %    disp(tline)
0034 end
0035 fclose(fid);

Generated on Tue 01-Jun-2010 09:50:19 by m2html © 2003