-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCoda_word.m
57 lines (46 loc) · 1.42 KB
/
Coda_word.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function Coda_Type=Coda_word(Detected_pattern)
% Detected_pattern=D_on_Whale(Segment_on_Whale(i)+1:end)';
% data = readcell('Codas_Reference2.xlsx');
%
% random_letter = 'NOISE';
% word_list = data(:,end);
% has_r = not( cellfun( @isempty, regexp( word_list, random_letter ) ) );
% word_list( has_r ) = [];
% Data=data(~has_r,:);
%
% D=Data(:,1);
% Analysis=Data(:,2:11);
%
% ICI=zeros(size(Data,1),9);
% for i=1:size(Analysis,1)
% NOC(i)=cell2mat(D(i,1));
% for j=1:size(Analysis,2)
% ICI(i,j)=cell2mat(Analysis(i,j));
% end
% end
load ICI; load Analysis; load Data; load NOC;
tokeep = Detected_pattern ~= 0; %logical array indicating which elements to keep
workingP = Detected_pattern(tokeep);
D_NOC = length(workingP);
A_inds=find(NOC==D_NOC+1);
Correspondance=[]; count=0;
for i=A_inds
count=count+1;
ICI_cand(count,:)=ICI(i,1:D_NOC);
word(count)=Data(i,end);
Correspondance(count)=mean((ICI_cand(count,:)-Detected_pattern').^2);
end
Thresh=0.03;
xxx=sort(Correspondance);
check=min(Correspondance);
if check<Thresh
id=find(Correspondance==check);
end
CT=Data(id,end);
Coda_Type=[];
if ~isempty(CT)
Coda_Type=cell2mat(CT);
else
Coda_Type=['Unseen'];
end
end