Matlab guarda automáticamente el archivo de Excel utilizando la interfaz ActiveX

Tengo un código en matlab. Después de haber ejecutado mi programa, se creó un archivo 'example2.xlsx'.

Ahora tengo el código a continuación y quiero que matlab reemplace el 'example2.xlsx' actual por el nuevo 'example2.xlsx' (guardando automáticamente sin preguntarme si quiero reemplazarlo):

<code>e = actxserver ('Excel.Application'); % # open Activex server
filename = fullfile(pwd,'example2.xlsx'); % # full path required
ewb = e.Workbooks.Open(filename); % # open the file
esh = ewb.ActiveSheet;


str = num2str(num_rows+1);
esh.Range(strcat('J',str)).Interior.Color = clr;

sheet1 = e.Worksheets.get('Item', 'Sheet1');
range1 = get(sheet1,'Range', strcat('A',str),strcat('I',str));
range1.Value = values{num_rows+1};

[num, txt, raw] = xlsread('example2.xlsx');
num_rows = length(num(:,1));


xlWorkbookDefault = 51; % # it's the Excel constant, not sure how to pass it other way
ewb.SaveAs(fullfile(pwd,'example2'), xlWorkbookDefault)
ewb.Close(false)
e.Quit
e.delete
</code>

Respuestas a la pregunta(1)

Su respuesta a la pregunta