您好我尝试通过MATLAB更改我的Excel条形图的颜色。
wksheet = eWorkbook.Worksheets.Item('Sheet2');
co = wksheet.ChartObjects.Item(1); % select the plot (this selects the first plot)
nbSeries = co.Chart.SeriesCollection.count;
% Delete previous series
for i= 1:nbSeries
Series = invoke(co.Chart,'SeriesCollection',1);
invoke(Series,'Delete');
end
% Create Series
nbNewSeries = size(organizedData.Page2.CorrToIndex2Txlsx,1);
for ii = 1:nbNewSeries
NewSeries = invoke(co.Chart.SeriesCollection,'NewSeries');
NewSeries.XValues = organizedData.Page2.CorrToIndex2Txlsx(ii,2);
NewSeries.Values = organizedData.Page2.CorrToIndex2Txlsx(ii,3);
NewSeries.Name = organizedData.Page2.CorrToIndex2Txlsx{ii,1};
end
我试过这个:
NewSeries3.MarkerBackgroundColor = paletteColors(iii,:)*255;
但是我收到了错误:
Parameter must be scalar.
您知道如何更改MATLAB的颜色吗?