parforの内部でPowerPointの操作は可能でしょうか?
Mostrar comentarios más antiguos
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 comentario
Walter Roberson
el 10 de Mzo. de 2016
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Parallel for-Loops (parfor) en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!