MATLAB: How to define ColorScale in Excel

actxserverexcelMATLAB

Hej, I have a problem with defining a colorscale.
Excel = actxserver ('Excel.Application');
Activesheet = Excel.Activesheet;
Activesheet.Columns.Item('R').FormatConditions.AddColorScale(3);
until here everything functions. I have a nice ColorScale in my opened Excelfile. Now I want to change my Scale:
Activesheet.Columns.Item('R').FormatConditions(1).ColorScaleCriteria(1).FormatColor = 8109667;
returns that 'ColorScaleCriteria' is a undefined function or variable.
Anyone knows a hint or a solution?
cheers

Best Answer

The Problem is selecting
FormatConditions(1)
In Matlab you have to rewrite this into
FormatConditions.Item(1)
this lead to
Activesheet.Columns.Item('R').FormatConditions.Item(1).ColorScaleCriteria.Item(1).FormatColor = 8109667;