如何从 Matlab 绘制 excel 条形图?
我能够绘制折线图。
e = actxserver('excel.application');
eWs = e.Workbooks;
eW = eWs.Add;
eS = eW.ActiveSheet;
e.Visible = 1;
x=(0:2:100)';y=sin(x);
eS.Range('A1:B50').Value = [x y];
eCO = eS.ChartObjects.Add(100, 30, 400, 250);
eC = eCO.Chart;
eC.SeriesCollection.NewSeries;
eC.SeriesCollection(1).Value = eS.Range('B1:B50');
eC.SeriesCollection(1).XValue = eS.Range('A1:A50');
eCO.Chart.ChartType = 1;
eCO.Chart.ChartType = 65;
eCO.Chart.HasTitle = true;
eCO.Chart.ChartTitle.Text = 'This is the title text'; % view it again
eW.Close;e.Quit;delete(e);