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

4 views (last 30 days)
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.

Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!