删除 powerpoint 演示文稿(如果存在)

Delete powerpoint presentation if it exists

我正在尝试做这样的事情,这是我的代码:

% Start an ActiveX session with PowerPoint:
ppt = actxserver('PowerPoint.Application');

% If Powerpoint with this title exists
if exist(pptTitle,'file');
  % Delete presentation:
  invoke(ppt.Presentations,'Delete',pptTitle);
end

但是 Matlab 无法识别该命令。有谁知道如何从 Matlab 中删除 Powerpoint 演示文稿?

作为次要问题,Matlab 中是否有关闭 powerpoint 应用程序的命令?

检查文件是否存在并删除:

  if exist(fileName, 'file')==2
      delete(fileName);
  end