Data = xlsread('数据.xlsx');
RowMatrix = Data(:,1);
[r,c] = size(Data);
threhold = 89.750;
Result = {};
IndexMatrix = [];
for k = 1:r
rowResult = rowResultFunc(Data(k,2:end),threhold)+1;
if ~isempty(rowResult)
Result = cat(1,Result,[k,rowResult]);
IndexMatrix = cat(1,IndexMatrix,k);
end
end
try
Excel=actxGetRunningServer('Excel.Application');
catch
Excel = actxserver('Excel.Application');
end
Excel.Visible = 1;
if exist(filespec_user,'file')
Workbook = Excel.Workbooks.Open(filespec_user);%打开已有的工作簿
else
Workbook = Excel.Workbooks.Add;%excel界面已经打开,但是还没有可编辑的工作簿时新建工作簿
Workbook.SaveAs(filespec_user);
end
Sheets = Excel.ActiveWorkbook.Sheets;
Sheet1 = Sheets.Item(1);
Sheet1.Activate;
for k = 1:size(Result,1)
for m = 2:length(Result{k})
cr = getColoumn(Result{k}(m));%将数值换成excel的字符表达
Sheet1.Range([cr,num2str(k)]).Interior.Color = 200;%excel指定单元格的背景颜色
end
end