How to control secondary-y-axes characters of xls-chart by matlab commands?
3 ビュー (過去 30 日間)
古いコメントを表示
I have draw an Excel chart with matlab commands, which has several lines and both primary/Secondary y-axes are used. My question is: how can I control the secondary y-axes characters with matlab commands?
I cannot find the answer from xlsgraph() or xlschart().
Thanks a lot
[Merged from duplicate]
I add a chart in Excel with matlab commands, which includes several lines and both Primary y-axis and Secondary y-axis are used.
I can change the x-axis & Primary y-axis characters using Chart.Axes(1) & Chart.Axes(2), but I didn't find a way to change the characters of the Secondary y-axis.
I have tried to use Chart.Axes(3) as the handle of the Secondary y-axis but failed.
My question is: How could I change the Secondary y-axis characters of a chart in Excel by matlab commands?
Thank you very much
2 件のコメント
回答 (1 件)
Guillaume
2015 年 7 月 17 日
Note that an easy way to find out what code you need is to record a macro in excel, do what you want to do manually, and finally look at the code of the macro. It won't be far from the code you have to write in matlab.
To access the secondary axis of the chart, you need to specify it as a second argument to Chart.Axes. It's a value of type xlAxisGroup. In matlab, you either supply 1 (the default if not specified) for Primary axis or 2 for secondary axis.
Chart.Axes(2, 2) %returns a Chart object representing the secondary group of the value axis.
I'm not sure what you mean by characters. If it's the text of axis label you want to change:
Chart.Axes(2, 2).AxisTitle.Text = 'sometext';
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!