我想从 Matlab 发送一个变量到 PowerPoint 或 AcrobatReader,然后根据这个变量的值,PowerPoint 转到下一张或上一张幻灯片或退出,或者在 acrobatreader 中放大或缩小。 是否可以?应该是因为现在我们可以通过远程控制来控制这类软件,这意味着它们可以从外部获取数据,但是协议(protocol)是怎样的或者是什么? 坦克斯。
最佳答案
您可以通过 ActiveX 驱动 PowerPoint
h = actxserver('PowerPoint.Application');
h.Visible = 1; % make the window show up
h.Presentations.Open('C:\Temp\MyPresentation.pptx');
%%
h.ActivePresentation.SlideShowSettings.Run; % there is now a slide show running
%%
hShow = h.SlideShowWindows.Item(1);
%%
hShow.View.GotoSlide(3); % go to the 3rd slide
hShow.View.Next; % go to next slide
%%
hShow.View.Exit; % end slide show
%%
h.ActivePresentation.Close; % close the presentation
%%
h.Quit;
delete(h);
您应该查看 actxserver
的 MATLAB 文档,以及 MSDN Power Point developer Reference . ActiveX 对象的大多数方法和属性在 MATLAB 中显示为方法和属性。您可以使用 methods(h)
和 get(h)
来检查它们。唯一棘手的是集合。您通常需要说类似 hCollection.Item(N)
的内容才能从集合中获取第 N 个项目。
关于matlab - 如何在 Matlab 和 power point 或 Matlab 和 acrobat reader 之间进行通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6359080/