Custom Print File Name

Hello!
I have the following line of code that exports a chart as a PNG file:
print -dpng printname.png -r250
I was wondering if I had a variable called "printaname" - how could I make Matlab save this file with that variable as the name fo the output image file? example if the printaname = AUD23-234 , the file would be AUD23-234.png.
Thanks! Dima

 采纳的回答

Jan
Jan 2012-3-13
printaname = 'AUD23-234';
print('-dpng', printname, '-r250')
There is an example in help print. It is always a good idea to read the documentation in case of problems.
[EDITED] Link to the help added.

4 个评论

thank you for your answer. I did check the help for print but did not see an example close to this one)
Here it is:
Pass in a file name as a variable:
filename = 'mydata';
print(h, '-dpsc', filename);
See [EDITED]: I've made "help print" a link to the corresponding section.
thanks) that method worked...

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Printing and Saving 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by