Hi,
In matlab I read a .BMP file of 20x20x3. Now I want to set the cell color of A1 of my workbook.xlsx, to the color of the first pixel.
% open image
a=imread('image1','bmp');% Connect to Excel
Excel = actxserver('excel.application');% Get Workbook object
WB = Excel.Workbooks.Open(fullfile(pwd, 'workbook1.xlsx'),0,false);% Set the color of cell "A1" of Sheet 1 to RGB
WB.Worksheets.Item(1).Range('A2').Interior.Color = RGB(a(1,1,1),a(1,1,2),a(1,1,3));% Save Workbook
WB.Save();% Close Workbook
WB.Close();% Quit Excel
Excel.Quit();
Well, this doesnt work. It works with interior.color = hex2dec('00FF00')
but not with RGB. How can I make this work? Error I get is: Undefined function or method 'RGB' for input arguments of type 'uint8'
Best Answer