2016-11-22 59 views
0

我是Matlab新手。導入以下類:mlreportgen.ppt.*,演示文稿在當前文件夾中創建。 但是,我想在不同的位置生成演示文稿。 發現以下語法,但我不確定如何實現它:如何更改matlab中的演示文件的路徑?

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') 

回答

0

您需要提供完整的路徑在outputFile中,默認情況下,該文件將在當前matlab路徑中創建。

創建演示文稿對象之前,只寫:

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

您也可以使用命令改變當前MATLAB文件夾:

cd(newCurrentFolder) 

你也應該避免使用strcat的路徑。 strcat刪除可能有時會出現問題的字符串尾隨空格。改爲使用cat()或方括號[str1 str2 ...]

+0

謝謝! @beesleep – Ish