Creating Variable Output Filename

1 回表示 (過去 30 日間)
Aadil
Aadil 2012 年 7 月 30 日
Hi, I have a script that generates a pdf full of plots.
I would like the output filename *.pdf file to be automatically named according to a variable which contains a date and title
How can I insert a variable filename?
This is the code which saves everything into a pdf:
ps2pdf('psfile', 'myfile.ps', 'pdffile', 'filename.pdf', 'gspapersize', 'a4')
Thanks,

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 30 日
psfilename = sprintf('myfile%s.ps', datestr(TheDate, 'yyyymmdd') );
ps2pdf('psfile', psfilename, 'pdffile', 'filename.pdf', 'gspapersize', 'a4')
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 7 月 31 日
How do you insert raw(3) ? The fact that raw(3) shows quotation marks on output tells us that raw is a cell array, and the third string in it would be accessed by raw{3} rather than raw(3) .
Aadil
Aadil 2012 年 7 月 31 日
Great! That worked thanks.
My next dilemna is converting the date into a filename friendly format, but I'll ask that in a seperate question

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by