How to clear an existing digit in excel using matlab?

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) 
+4
source share
1 answer

Great questions. I can not leave comments, so I will answer here.

Perhaps one of them will work for you.

ActiveSheet.Shapes.Delete
ActiveSheet.DrawingObjects.Delete
ActiveSheet.Pictures.Delete
0

Source: https://habr.com/ru/post/1626982/


All Articles