如何改变MATLAB中的演示路径



我是MATLAB编程的新手。导入以下类:mlreportgen.ppt.*,在当前文件夹中创建了演示文稿。但是,我想在不同位置生成演示文稿。找到以下语法,但我不确定如何实施它:

presentationObj = Presentation() creates a presentation named Untitled.pptx in the current folder, using the default PPT API default.pptx template.
presentationObj = Presentation(presentationPath) creates a presentation at the specified location.
presentationObj = Presentation(presentationPath,templatePath) creates a presentation using the PowerPoint template at the specified location.

在我的代码中,使用以下内容在演示文稿中生成幻灯片:

slides = Presentation(outputFile, strcat('template_', num2str(number_of_devices))); "
where outputfile = strcat ('name','.pptx')

您需要在outputFile中提供一个完整的路径,否则,该文件将在当前MATLAB路径中创建。

在创建演示对象之前,只需写:

outputfile = 'c:pathtoyourfile.pptx' (windows)
outputfile = '/path/to/your/file.pptx' (linux)

您还可以使用命令更改当前的MATLAB文件夹:

cd(newCurrentFolder)

您还应避免将strcat用于路径。strcat从字符串中删除落后空间,这有时可能是有问题的。改用cat()或方括号[str1 str2 ...]

最新更新