参考我之前的问题(使用 matlab 将迷你图添加到 excel 中),我可以设法创建迷你图,但我不知道如何将高点/低点着色为绿色/红色。我试过:
% Open new workbook
excel = actxserver('excel.application');
excel.visible = 1;
wrkbook = excel.Workbooks.Add();
sheet = wrkbook.Sheets.Item(1);
% Write some data
sheet.Range('B1:Z1').Value = rand(1,25);
% Add column sparklines to 'A1', type 'xlSparkColumn' and DataSource: 'B1:Z1'
excel.ReferenceStyle = 'xlA1';
s = sheet.Range('A1').SparklineGroups.Add('xlSparkColumn','B1:Z1');
% Color
s.Point.Highpoint.Color.Color = 4697456;
s.Point.Lowpoint.Color.Color = 255;
另请参阅有关设置自定义单元格背景颜色的此参考