-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetMNIST.m
More file actions
80 lines (76 loc) · 1.6 KB
/
getMNIST.m
File metadata and controls
80 lines (76 loc) · 1.6 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
%% getMNIST.m
%MAT 128b Project 2
%function to retrieve MNIST data
function data = getMNIST(digit, train)
if train > 1 || train < 0
disp('getMNIST.m Error: train variable passed is not boolean, returned 0')
data = 0;
return;
end
load mnistdata;
if digit == 0
if train == 1
data = train0;
else
data = test0;
end
elseif digit == 1
if train == 1
data = train1;
else
data = test1;
end
elseif digit == 2
if train == 1
data = train2;
else
data = test2;
end
elseif digit == 3
if train == 1
data = train3;
else
data = test3;
end
elseif digit == 4
if train == 1
data = train4;
else
data = test4;
end
elseif digit == 5
if train == 1
data = train5;
else
data = test5;
end
elseif digit == 6
if train == 1
data = train6;
else
data = test6;
end
elseif digit == 7
if train == 1
data = train7;
else
data = test7;
end
elseif digit == 8
if train == 1
data = train8;
else
data = test8;
end
elseif digit == 9
if train == 1
data = train9;
else
data = test9;
end
else
disp('getMNIST.m Error: more than one digit passed, returned 0');
data = 0;
return;
end
end