-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpreadsheet_confusionMat.m
138 lines (86 loc) · 3.07 KB
/
Spreadsheet_confusionMat.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
function Spreadsheet1 = Spreadsheet_confusionMat(data,percentErrAvg)
numRows = size(data,1);
numColumns = size(data,2);
% INSTANTIATE THE CONTROL
h.f = figure;
psn = get(h.f,'Position');
%Spreadsheet1 = actxcontrol('OWC9.Spreadsheet.9',[0 0 psn(3:4)]);
%Spreadsheet1 = actxcontrol('OWC10.Spreadsheet.10',[0 0 psn(3:4)]);
Spreadsheet1 = actxcontrol('OWC11.Spreadsheet.11',[0 0 psn(3:4)]);
% USE AN ENUMERATED TYPE WORKAROUND
% ClassEnumType = {'cell','char','logical','numeric'};
% FIND THE ACTIVE SHEET
ActSheet = get(Spreadsheet1,'ActiveSheet');
% FIND THE ACTIVE CELL, ROW AND COLUMN
% THIS IS NOT NECESSARY, BUT IT IS DONE FOR DEMONSTRATION
ActCell = get(Spreadsheet1,'ActiveCell');
ActCellRow = get(ActCell,'Row');
ActCellColumn = get(ActCell,'Column');
% SET COLUMN WIDTH
% ActCell.ColumnWidth = 24;
% SET ROW HEIGHT
% ActCell.RowHeight = 24;
cell_current = nn2an(1,1);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','True ');
% % -----------
cell_current = nn2an(2,1);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','Healthy');
% % -----------
cell_current = nn2an(3,1);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','MI');
% % -----------
cell_current = nn2an(2,2);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value',data(1,1));
% % -----------
cell_current = nn2an(2,3);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value',data(1,2));
% % -----------
cell_current = nn2an(3,2);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value',data(2,1));
% % -----------
cell_current = nn2an(3,3);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value',data(2,2));
% % -----------
cell_current = nn2an(4,2);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','Healthy');
% % -----------
cell_current = nn2an(4,3);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','MI');
% % -----------
cell_current = nn2an(4,4);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
set(ActCell,'Value','Predicted');
% % -----------
% cell_current = nn2an(5,1);
cell_current = nn2an(6,1);
Select(Range(ActSheet,cell_current));
ActCell = get(Spreadsheet1,'ActiveCell');
% ActCell.ColumnWidth = 24;
percentErrAvg_string = strcat('','Average Percent Testing Error= ',num2str(percentErrAvg));
% percentErrAvg_string = sprintf('%s%f','Average Percent Testing Error= ',percentErrAvg);
set(ActCell,'Value',percentErrAvg_string);
% % -----------
function cr = nn2an(r,c)
% Thanks Brett Shoelson
t = [floor((c - 1)/26) + 64 rem(c - 1, 26) + 65];
if(t(1)<65), t(1) = []; end
cr = [char(t) num2str(r)];