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

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
無効であるか削除されたオブジェクトです。

댓글 수: 1

Walter Roberson
Walter Roberson 2016년 3월 10일
Approximate translation:
In m script, to edit a single PowerPoint file at parfor is, What can not I? More specifically, I was created as a sample "to specify the slide number and paste the figure treatment," but, by using parallel processing (parfor) this, I want to be moved quickly. After running the script, such as the following, the following error, such as has occurred.

댓글을 달려면 로그인하십시오.

 채택된 답변

Steven Lord
Steven Lord 2016년 3월 10일

0 개 추천

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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

제품

질문:

2016년 3월 10일

답변:

2016년 3월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by