MATLAB: Parforの内部で​PowerPoint​の操作は可能でしょう​か?

MATLABparfor日本語

mスクリプトで、1つのパワーポイントファイルを parforにて編集することは、出来ないのでしょうか? 具体的には「スライド番号を指定してfigureを貼り付ける処理」をサンプルをとして作成したのですが、これを並列処理(parfor)を用いて、早く動かせるようにしたいです。 以下のようなスクリプトを実行したら、以下のようなエラーが発生しました。
% ppttest_parfor.m
function ppttest_parfor()
  ppt = actxserver('PowerPoint.Application');
  ppt.Visible = 1;
  ppt1 = ppt.Presentations;
  presen1=invoke(ppt1,'Add');
  slides=presen1.Slides;
  slide = cell(5,1);
  for index = 1:5
   slide{index} =invoke(slides,'Add', index, 4);
  end
  %関数を呼び出す
  parfor index = 1:5
   ppttest_func(slide{index}, index); %エラー発生箇所
  end
  invoke(ppt, 'Quit');
end
 % 関数 
function [] = ppttest_func(slide, index)
newSlide = get(slide);
title1 = newSlide.Shapes.AddTextbox('msoTextOrientationHorizontal',0,15,400,70);
title1.TextFrame.TextRange.Text = ['■', num2str(index) '枚目のスライド'];
title1.TextFrame.TextRange.Characters.Font.Bold ='msoTrue';
title1.TextFrame.TextRange.Characters.Font.Name ='HGP創英角ゴシックUB';
title1.TextFrame.TextRange.Characters.Font.Size =24;
end
%エラー内容
 エラー:ppttest_func(line2)
無効であるか削除されたオブジェクトです。
 エラー:ppttest_parfor(line11)
parfor Index = 1:5
原因:
  エラー:handle.handle/get
無効であるか削除されたオブジェクトです。

Best Answer

In this case, the slide input to the function that you're calling inside the PARFOR is an object. When using objects in a PARFOR, there are some additional issues that you need to consider.