excel - Matlab Actxserver: ¿Cómo podría finalizar el proceso abierto por actxserver en matlab
com office-interop (1)
Aquí hay un ejemplo que crea una nueva hoja de cálculo, escribe algunos valores, guarda el archivo y sale. El proceso de Excel finaliza limpiamente al final.
% create Excel COM server
excel = actxserver(''Excel.Application'');
excel.Visible = true; % make the window visible
% create new workbook
wb = excel.Workbooks.Add();
% get "Sheet1" and activate it
sheet = wb.Sheets.Item(1);
sheet.Activate();
% select a 5x5 range, and fill it with some numeric values
sheet.Range(''A1:E5'').Value = num2cell(magic(5));
% save spreadsheet file
excel.DisplayAlerts = false; % overwrite file without prompts
wb.SaveAs(fullfile(pwd(),''myfile.xlsx''));
% close spreadsheet
wb.Close(false);
% quit Excel
excel.Quit();
% delete handles and clear variables
delete(excel);
clear sheet wb excel
Además, es posible que desee establecer ciertas propiedades de forma apropiada, si desea que la automatización se realice en segundo plano sin interacción del usuario:
excel.Visible = false; % invisible Excel window
excel.ScreenUpdating = false; % turn off screen update to run faster
excel.Interactive = false; % non-interactive mode, with no keyboard/mouse
excel.DisplayAlerts = false; % no prompts or alert messages
excel.UserControl = false; % object freed when reference count reaches zero
Quiero abrir y cerrar un archivo de Excel en MATLAB. He intentado el siguiente código , pero falló en el proceso de cierre con actxserver
h.WorkBooks.Item(wbkname).Close;
aquí está mi código para este problema, ¿cómo puedo terminar el archivo de Excel?
.Quit
.delete
También traté de cerrar el archivo Excel a través del submódulo VBA, pero me da un mensaje de error:
fullFileName = [pwd ''/KOSPI200_1월.xlsm''];
excel = actxserver(''Excel.Application'');
file = excel.Workbooks.Open(fullFileName);
excel.Run(''jongho_bot_initial'');
excel.Run(''jongho_bot_loop'',2);