-
Notifications
You must be signed in to change notification settings - Fork 3
/
getDataset.m
37 lines (30 loc) · 998 Bytes
/
getDataset.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
function [X, y] = getDataset(dirName)
%GETDATASETFROMDIR Summary of this function goes here
% Detailed explanation goes here
dirInfo = dir(dirName);
X = zeros((length(dirInfo) - 2) * 20, 100);
y = zeros((length(dirInfo) - 2) * 20, 1);
count = 0;
for i = 1:numel(dirInfo)
if strcmp(dirInfo(i).name, '.') || strcmp(dirInfo(i).name, '..')
continue;
end
speakerDir = strcat(dirName, dirInfo(i).name, '/');
digitsInfo = dir(speakerDir);
for j = 1:numel(digitsInfo)
if strcmp(digitsInfo(j).name, '.') || strcmp(digitsInfo(j).name, '..')
continue;
end
if strcmp(digitsInfo(j).name(1), 'O')
continue;
elseif strcmp(digitsInfo(j).name(1), 'Z')
label = 0;
else
label = str2double(digitsInfo(j).name(1));
end
count = count + 1;
y(count) = label;
X(count,:) = extractFeatures(strcat(speakerDir, digitsInfo(j).name));
end
end
end