Can't open figure when saving with 'saveas',

4 次查看(过去 30 天)
I'm saving a figure as a .png and a .fig file. It generates the files, and the png file works fine to open, but I am unable to open the .fig-file (neither through importing it using the file menu or double clicking it). Here is the part of my code which saves the plot:
scplot=figure('Visible','off');
saveas(scplot,[paths{1} '\Flood Frequency Analysis Files\' today '\' sheets{n} '\Scatter_plot_of_annual_max_' sheets{n} '_Matlab_Plot.fig'])
saveas(scplot,[paths{1} '\Flood Frequency Analysis Files\' today '\' sheets{n} '\Scatter_plot_of_annual_max_' sheets{n} '_Image.png'])
The paths are a bit messy, but the files are saves in the right Place with the right format, and as I said the second saveas returns a functioning .png image.
I've tried using savefig instead of saveas and it gave the same error. Using saveas or savefig in the command line works fine, it's just in my function that it doesn't work.

回答(0 个)

类别

Help CenterFile 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