From: Francki on
Hi guys,

well I've manage to plot a set a a graphs in excel using matlab via the actxserver of course.......and I almost succeeded except There is a little bump in the road that I encountered.

2....I'm trying to change the gap width of data to 50
1....the alignment of the data on the x-axis has to be pointing upwards
3.....make the graph display the values and set them to 1 d.p.

Here is what I've comeup with (of course matlab keep returning errors):

exl= actxserver('excel.application');
dr='C:\Users\Me\Desktop\';
file='Templatexls.xls';
% Load data from an excel file
% Get Workbook interface and open file
exl.visible = true;
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open([dr file]);
exlSheetchartinlap=exlFile.Charts.Item('InLap comparison');
.....................................................................................
......................................................................................
Problem 1: Matlab doesn't recognise code????
......................................................................................
exlSheetchartinlap.Axes(xlCategory).Select;
exlSheetchartinlap.Axes(xlCategory).TickLabels.Alignment='xlCenter';
exlSheetchartinlap.Axes(xlCategory).TickLabels.Offset = 100;
exlSheetchartinlap.Axes(xlCategory).TickLabels.ReadingOrder=1;
exlSheetchartinlap.Axes(xlCategory).TickLabels.Orientation = 'xlUpward';
......................................................................................
Problem 2: yet another vba (macro) code matlab doesn't recognise
......................................................................................
exlSheetchartinlap.SeriesCollection(1).ChartGroups(1).Overlap=0;
exlSheetchartinlap.SeriesCollection(1).ChartGroups(1).GapWidth = 50;
exlSheetchartinlap.SeriesCollection(1).ChartGroups(1).HasSeriesLines='False';
exlSheetchartinlap.SeriesCollection(1).ChartGroups(1).VaryByCategories = 0;
......................................................................................
Problem 3: code not working still
......................................................................................
exlSheetchartinlap.ApplyDataLabels.AutoText='True';
exlSheetchartinlap.ApplyDataLabels.LegendKey='True';
exlSheetchartinlap.ApplyDataLabels.HasLeaderLines='False';
exlSheetchartinlap.ApplyDataLabels.ShowSeriesName='False';
exlSheetchartinlap.ApplyDataLabels.ShowCategoryName='False';
exlSheetchartinlap.ApplyDataLabels.ShowValue='True';
exlSheetchartinlap.ApplyDataLabels.ShowPercentage='False';
exlSheetchartinlap.ApplyDataLabels.ShowBubbleSize='False';
exlSheetchartinlap.SeriesCollection(1).DataLabels.NumberFormat='0.0';

I've tried every combination possible and I'm about to quit but i thought there might an expert here that can sort things out.....Help out sorting my problems please!!
anyone!

Regards!
 | 
Pages: 1
Prev: m-file to text
Next: read value on a certain line