I have an excel that is connected to Matlab through an active server. I create a graph through matlab and export it to excel. However, I need to clear existing graphs first so that it does not overwrite and collect graphs.
My idea is to first find the existing graph and clear it. But so far I still do not know how to do this.
Somebody knows? I am open to any suggestions.
Thank you very much!
Elizabeth
edit:
this is matlab script
Excel = actxserver ('Excel.Application');
filename = 'xxx'
invoke(Excel.Workbooks,'Open',filename);
Sheets = Excel.ActiveWorkBook.Sheets;
Sheets.Item('Graphs').Activate;
ActiveSheets = Excel.Activesheet;
plotpie(cost,init_stage)
Shapes = ActiveSheets.Shapes;
ActiveSheets.Shapes.AddPicture('location', 0, 1, 400, 325, 345, 230)
source
share