FINDINC.M
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- function out = findinc(fileName)
- % FINDINC Find included files in a give file
- fid = fopen(fileName);
- if fid<0,
- error('Cannot open file!');
- end
- lineNum = 1;
- while 1
- line = fgetl(fid);
- if ~isstr(line), break, end
- contents{lineNum} = xlate(line);
- lineNum = lineNum+1;
- end
- fclose(fid);
- out = {};
- for i=1:length(contents),
- line = contents{i};
- if ~isempty(line),
- pos = findstr(line, '#include "');
- if ~isempty(pos) & pos==1,
- temp = split(line, '"');
- out = {out{:}, temp{2}};
- end
- end
- end
- % Function for split
- function tokenList = split(str, delimiter)
- % SPLIT Split a string based on a given delimiter
- % Usage:
- % tokenList = split(str, delimiter)
- % Roger Jang, 20010324
- tokenList = {};
- remain = str;
- i = 1;
- while ~isempty(remain),
- [token, remain] = strtok(remain, delimiter);
- tokenList{i} = token;
- i = i+1;
- end