matlab to excel conditional formatting using different sheet.

4 views (last 30 days)
Hi, I have some data in a matrix (data) and various checks have been applied on this data (and more) to get a logical array of 'flags'. I would like to write data to excel and highlight the cells which have failed (equal to 1) according the flag array. The flag array will also be written to excel in a separate sheet but will not be formatted.
I am using xlsCondFormNeg from file exchange and have got it working for conditions within data but not by using another sheet Does anyone know how I would change the part of the script below to allow me to format matrix 'data' using logical array 'flags'?
I tried creating a macro in excel to get the VB script and using ['=' range 'Flags!>0'] instead but I get ' Invoke Error, Dispatch Exception: The parameter is incorrect.' I have (probably obviously) little experience with VB beyond the very basic so any help would be appreciated.
ExAct = Excel.Activesheet; ExActRange = get(ExAct,'Range',range); ExActRange.Select;
xlExpression=2; Excel.Selection.FormatConditions.Delete; Excel.Selection.FormatConditions.Add(xlExpression, [], ['=' range '>0']); Excel.Selection.FormatConditions.Item(1).Font.ColorIndex = 3;
thanks
Rachel

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!