Home > asr > plpRead.m

plpRead

PURPOSE ^

plpRead: Read a plp file

SYNOPSIS ^

function plp=plpRead(plpFile)

DESCRIPTION ^

 plpRead: Read a plp file
    Usage: plp=plpRead(plpFile)

    For example:
        plp=plpRead('但使龍城飛將在.plp')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plp=plpRead(plpFile)
0002 % plpRead: Read a plp file
0003 %    Usage: plp=plpRead(plpFile)
0004 %
0005 %    For example:
0006 %        plp=plpRead('但使龍城飛將在.plp')
0007 
0008 %    Roger Jang, 20060926
0009 
0010 contents=textread(plpFile, '%s', 'delimiter', '\n', 'whitespace', '');
0011 lineNum=length(contents);
0012 
0013 k=1;
0014 index=1;
0015 while index<=lineNum
0016     line=contents{index};
0017     if length(line)==0
0018         index=index+1;
0019         continue;
0020     end
0021     if line(1)=='%'
0022         index=index+1;
0023         continue;
0024     end
0025     items=split(line, ' ');
0026     if length(items)==3
0027         plp(k).modelName=items{1};
0028         plp(k).modelIndex=eval(items{2})+1;        % For MATLAB indexing
0029         plp(k).frameNum=eval(items{3});
0030         index=index+1;
0031         plp(k).compModelIndex=sscanf(contents{index}, '%d');
0032         plp(k).compModelIndex=plp(k).compModelIndex+1;    % For MATLAB indexing
0033         index=index+1;
0034         plp(k).compModelProb =sscanf(contents{index}, '%f');
0035         index=index+1;
0036         k=k+1;
0037     end
0038 end

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