loo.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- function waveData = loo(waveData, distmat, mode)
- % LOO Leave-one-out test
- if nargin<1, mode=1; end
- waveNum = length(waveData);
- h = waitbar(0, 'Please wait...');
- for i = 1:waveNum,
- % fprintf('i = %gn', i);
- waveData(i).rank = rundtwfcn1(waveData, i, mode, distmat);
- waitbar(i/waveNum, h);
- end;
- close(h)
- %=================sub function 1========================
- function rank = rundtwfcn1(waveData, index, mode, distmat)
- waveNum = length(waveData);
- distance = distmat(index, :);
- if mode == 1, % Mode 1 is file-based LOO test
- distance(index) = inf;
- else % Mode 2 is speaker-based LOO test
- for i=1:waveNum,
- if strcmp(waveData(index).speaker, waveData(i).speaker),
- distance(i) = inf;
- end
- end
- end
- [a,b] = sort(distance);
- for i = 1:length(b),
- if strcmp(waveData(b(i)).answer, waveData(index).answer);
- rank = i;
- break;
- end
- end