Matlab绘制一个excel单元格

有人可以帮我画一个Excel中的单元格通过rgb在matlab中? 我希望第10格将由rgb绘制。

values{1}(1,:) = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '10'}; headers = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}; xlswrite('example.xls', [headers; values{1}]); 

万分感谢 :]

您可以使用以下过程为现有文件中的单元格着色:

 values = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '10'}; headers = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}; rgb = [255 0 0]; %# if you have 0 to 1 values multiply by 255 and round clr = rgb * [1 256 256^2]'; %'# convert to long number Excel understands e = actxserver ('Excel.Application'); %# open Activex server filename = fullfile(pwd,'example.xls'); %# full path required if exist(filename,'file') ewb = e.Workbooks.Open(filename); %# open the file else error('File does not exist.') %# or create a new file end esh = ewb.ActiveSheet; for c = 1:numel(values) esh.Range(strcat(headers{c},values{c})).Interior.Color = clr; end ewb.Save ewb.Close(false) e.Quit 

您也可以使用hex值指定RGB颜色,并使用hex2dec 。 在这种情况下,顺序应该是相反的,如红色的0000FF