-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateSongdataSet.m
45 lines (28 loc) · 1.04 KB
/
CreateSongdataSet.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
function [songDataset] = CreateSongdataSet(sap_xlsfile,~,~)
colTitles = {'name','duration','start','amplitude','pitch',...
'FM','AM^2','entropy','pitch goodness', 'mean freq',...
'pitch','FM','entropy','pitch goodness',...
'mean freq','AM','file name'};
searchstr = sap_xlsfile(2,:);
colNum = zeros(length(colTitles),1);
for colcount = 1:length(colTitles)
colNum(colcount) = find(strcmp(colTitles(colcount),searchstr),1,'first');
end
begin = colNum(1);
last = colNum(end-1);
fnaCol = colNum(end);
if isnan(sap_xlsfile{end,1})
lastrow = size(sap_xlsfile,1) - 1;
else
lastrow = size(asp_xlsfile,1);
end
sapXlsTrans = sap_xlsfile(1:lastrow,begin:last);
sapXlsTrans(1:lastrow,17) = sap_xlsfile(1:lastrow,fnaCol);
sapXlsTrans(1:2,:) = [];
NewcolTitles = {'name','syldur','sylstart','Mamp','Mpitch',...
'MFM','MAM','Mentropy','MpitchG', 'Mfreq',...
'Vpitch','VFM','Ventropy','Vpitchg',...
'Vfreq','VAM','filename'};
sapXlsTitles = vertcat(NewcolTitles , sapXlsTrans);
%%
songDataset = cell2dataset(sapXlsTitles);