I’m making a spreadsheet from a Matlab function using the ActiveX link to Excel. I want to program in conditional formatting in the spreadsheet where cell A1 background changes to yellow based on its value. I took a guess based on a macro but it didn’t work. I’ve posted the code below. The function bombs out on the second line. Does anyone else know how to do this?
range = get(XL.Activesheet, 'Range', 'A1', 'A1');
set(range.FormatConditions.Add, 'Expression', '=$A$1<10');
set(range.FormatConditions(1).Interior, 'color', 65535);
range = get(XL.Activesheet, 'Range', 'A1', 'A1');
set(range.FormatConditions.Add, 'Expression', '=$A$1<10');
set(range.FormatConditions(1).Interior, 'color', 65535);