Can I save my figure somewhere else on my computer besides the MATLAB folder? (Using Saveas)

5 ビュー (過去 30 日間)
The code I created is going to be turned into a stand alone program so others within my company can use it. One of the popup menus allows you to choose what kind of file you would like save the figure as, and this works perfectly since I have Matlab and it sends it to the folder. But now that I will be making it a stand alone program, where would the file be saved?, and can I change its destination? Thanks in advance!

採用された回答

Rik
Rik 2018 年 8 月 7 日
You are right that the documentation for saveas doesn't explicitly state that you can use a filename with an absolute or relative path, but you can.
f=figure(1);clf(1)
plot(rand(1,10))
if ~exist('new_folder','dir'),mkdir('new_folder');end
saveas(f,'new_folder\foo.png')
  11 件のコメント
MechE1
MechE1 2018 年 8 月 8 日
編集済み: MechE1 2018 年 8 月 9 日
Just switched over to this and is working great. On another note, any idea why my 3rd input for uiputfile (graphName) isnt working? For some reason instead of only placing the graph name as a suggested file name it does the following:
"(Name of my graph).EPS Lvl 3 B&W.EPS Lvl 3 B&W"
It must be something to do with the filter, but my code is exactly how I wrote in the comments. Pretty confused on this.
Just attached an image of what happens
Rik
Rik 2018 年 8 月 9 日
From the doc:
The first column of the input filter cell array contains the file extensions, and the second contains the descriptions of the file types.
So you entered " .EPS Lvl 3 B&W " as the extension.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by