File Exchange

image thumbnail

Save Multiple Figures in a click

version (64 KB) by Nicolas Beuchat
Save multiple figures with a GUI in several formats. No need to save all figures one-by-one anymore!


Updated 08 Mar 2012

View Version History

View License

savemultfigs allows one to save all opened figures using a nice user interface and in several formats in one time. No need to save all figures one-by-one anymore!

The following features are available:
- Select which figures to save in a click
- Name each figure independently based on the figure name if specified (credits go to Tassos for this feature)
- Save the same figures in several formats at once
- Save in 14 different formats (fig, jpg, eps, tif, etc.)
- Create a subdirectory for each format

This tool is particularly suited if you have a large number of figures to export at once and/or if you often save the same figure in several formats (fig, tif and eps for example).

Cite As

Nicolas Beuchat (2021). Save Multiple Figures in a click (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (64)


not showing open figure inside GUI in matlab R2018b?

Raphael Lomonaco

Cant thank you enough


why doesn't work anymore?

Liu Yang

This is really a nice tool! I have used it a lot when I am writing some documents. I have found some drawbacks, but it has not been updated for a long time. Thus, I tried to read the code and add some features and fix some bugs that I think is useful on it. I have put it on my Github repository (link: ). Anyone who has interested can download and have a try. Issues are welcomed!

Unfortunately, Leon's modifications for R2014 has become obsolete. Code needs to be updated to make it compatible with newer versions.
List of figures don't appear on GUI for R2017b. Following errors show up when pressing the save button:

Struct contents reference from a non-struct array object.

Error in savemultfigs>pushbuttonSave_Callback (line 339)
for i=1:handles.numberFig

Error in gui_mainfcn (line 95)

Error in savemultfigs (line 39)
gui_mainfcn(gui_State, varargin{:});

Error in>@(hObject,eventdata)savemultfigs('pushbuttonSave_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.


Ambika PS

how do you call this function inside a program? Can someone tell me please. I am using R2016b.

Craig Ulrich

This is really great and thanks Leon for giving the instructions on what parts of the code to change to work with 2015b. I did notice I get errors if I just launch the GUI but if I run the code it launches the GUI and works great. Cheers and thanks from a noobie!

Kevin Sweeney

Very good, and thanks to Leon for the fix for newer versions of Matlab

Yang Liu

Nice Tool


Very useful script. Unfortunately, hit a snag while using the modified script (via Leon's changes). When performing the save I get the following errors:

Error using num2str (line 45)
Input to num2str must be numeric.

Error in savemultfigs>pushbuttonSave_Callback (line 343)
dosave = get(findobj('Tag',['checkboxFigure' num2str(handles.figlist(i))]),'Value');

Error in gui_mainfcn (line 95)

Error in savemultfigs (line 39)
gui_mainfcn(gui_State, varargin{:});

Error in>@(hObject,eventdata)savemultfigs('pushbuttonSave_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback

Amin Khalaf

Very helpful, it is works for newer versions but with small modifications mentioned by Leon (see blew)

Manolis Trypakis

Great tool, I have used it in the past. Does not work for newer versions of Matlab though which is a pity.

Manolis Trypakis


It is cool! But it cannot handle figures not using the default size. If I want my fig 800*600, savemultfigs cannot save the figure as a .png or .emf file with this size, while .fig may work well.

Alex Ortiz

Great tool! Doesn't work for R2015a/b though, it will great to get it fix :)

Stevan Jeknic

Doesn't work in 2015b.



Is it possible to change the resolution at which the figure is saved at .jpg or .png?

Furthermore, how do I save it as .pdf in landscape?



Didn't work for subplots and for more than 25ish plot the scroll bar isn't helpful, it jumps in decimal values! Shame!

Md. Golam Mostafa

It was extremely helpful for me.


Dominik - I just downloaded 2015a and Leon's suggestion works for me. If you tell me how to upload the modified file, I can.

Dominik Ginnheim

2014b. I did implement Leon's suggestions, however it is still not running. It is getting incredibly slow and crashes very often. Does anyone share the same experience? Did you find a solution to this?

sairamesh nammi

Thank you so much for the file. This is what I am looking for.

Faizan Rehmatullah

When I change the size of my figure, the PDF and EPS files do not scale properly. Any suggestion on fixing this problem?

Abhinav Garg

For saving eps figures in colored format instead of black and white, one way is to add the following line after line no. 315 in the code.

filetype = strrep(filetype,'eps', 'epsc');


Good, but when the figure is named with a text that has a file extension, it doesn't work. For example, if I plot a figure and name the title say "data.log" using the command
And after that if I open the savemultfigs GUI, it picks up the figure but also throws an error
Error using savefig (line 41)
Argument must be a .fig file
I think this is because it sends the actual name of the figure as an argument and then doesn't know what to do with it if an extension is there in the name.


Really useful tool, thanks!

t3925, Raffaello:
The problem is related to new graphic handles in r2014b. You just need to replace every expressions:

"num2str(figlist(i))" with "num2str(figlist(i).Number)"


"num2str(handles.figlist(i))" with "num2str(handles.figlist(i).Number)"



Thank you for creating this tool. I've been using it extensively and it is a huge time saver. Unfortunately it no longer works as of R2014b due to the same error below highlighted by Raffaello.

It's been so useful that I'm seriously considering sticking for R2014a for this tool alone!


This script would be very useful for me, but it does not run on Unix R2014b. The output I get when I launch the script is:

>> clear all
>> figure
>> figure
>> savemultfigs
Undefined function 'abs' for input arguments of type 'matlab.ui.Figure'.

Error in num2str (line 66)
xmax = double(max(abs(widthCopy(:))));

Error in savemultfigs>savemultfigs_OpeningFcn (line 90)
defaultfilenames{i} = [defaultfilename num2str(figlist(i))];

Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in savemultfigs (line 39)
gui_mainfcn(gui_State, varargin{:});



Great gui! It appears eps is saved in black and white? Is there a way to change that? Thanks!!


Awesome tool!
A bug: figure names with comma create one file with no extension and stop the saving process for all further files (same file with different extension of other files).



Works perfectly.


This is a great tool. One suggestion: if you change the eps box to epsc then it will save as a color image.

Soner Ulun


perfct tool


Leonardo Jose Trejo

Very nice little tool. Thanks! Two comments: first, when saving files of a given type, e.g. ".fig," the function didn't append the extension to the file names, so Windows Explorer didn't know how to open the files later. It would be nice to auto-append this. Also, on a Mac, I could not paste a string of characters into the field for folder name or the fields for file names. I wanted to use as the base for the file name and had to type in a long string into each field. This worked in Windows, however.



so,so good. thank you for taking the time to create this.

Manolis Trypakis

You saved me a huge amount of time. Very helpful, efficient and flexible. Thank u Nocolas!

Rajib Mozumder

Excellent GUI! For some reason, when I save files as .eps, they are saved as black and white and .emf doesn't work! Other than that, all the other formats are working fine.

Nicolas Beuchat

Hi Lucas,

I imagine that you are referring to the default file name feature? The program take as default filename the figure name (not the title). You can change the figure name by doing:




When I download the file, I seem to be getting an older version rather than the march 2012 update

Jessica ?

Yes, it's called two times. Thank you very much! The function is really useful for me !

Nicolas Beuchat

Hi Jessica!

Did you call savemultfigs a second time? Or do you have this error systematically? There is a bug I haven't solved yet that gives this error when savemultfigs is called a second time while the other savemultfigs is still open.

If that's the case, the solution for now is simply to close the gui and relaunch savemultfigs.

Thanks for the comments! I will try to solve this bug and incorporate other useful comments.


Jessica ?

Hi, when I run the code, a problem comes out'Conversion to logical from cell is not possible.

Error in savemultfigs>pushbuttonSave_Callback (line 341)
if dosave

Error in gui_mainfcn (line 96)

Error in savemultfigs (line 39)
gui_mainfcn(gui_State, varargin{:});

Error in

Error while evaluating uicontrol Callback'

Could anyone help me?
Thanks a million.


This is great! Thank you very much for creating this! Saved me so much time! :)


What I find Odd is the inconsistency in this program saving, vice using save in the toolbar.
For instance, I have my figures set up with the PaperOrientation to Landscape. When I save as PDF from the toolbar, MATLAB still saves it in Portrait format. Your program is actually better for PDF as it saves it in Landscape.
However, the opposite is true for PNG files. Saving from the Toolbar gives me landscape, your program gave me rotated landscape. (Easy enough to fix with a graphics editor though)

Don't get me wrong, great tool! Will save me a lot of time, regardless.

Abhinav Garg

Very helpful. But I have issues when saving the figures as .eps as it saves them as black & white image. Please clarify.

Abhinav Garg

Very helpful. But I have issues when saving the figures as .eps as it saves them as black & white image. Please clarify.

Matteo Niccoli

Very much needed

Scott Otterson

Handy! One suggestion: if the output directory doesn't exist, offer to make it. I expected this because it already makes directories for the different file types.


Great submission. I would suggest adding an option for anti-aliasing (see Myaa - My Anti-Alias for Matlab). Also great would be the ability to use TeX to render the text. Finally it would be great if you could merge all the results into a single PDF.



Yeap, changes should definitely be kept in the same file :) So, please go ahead and update the file here too.

Nicolas Beuchat

Thank you for the suggestion! It is a very good idea!

I implemented your modification with a slight change in the code (you actually don't need to convert from mat2cell and cell2mat by using defaultfilenames{i}).

If you don't mind, I'd rather update this file so that everything is kept at one place! I will obviously mention you.

Thanks again!


Very useful app! However, I thought that it would be more useful if it was detecting the 'Name' given to each figure and automatically use it as default filename for the saving.

So I did the following modification, by changing the definition of 'defaultfilename' from a simple 'filename' like this:

for i=1:length(figlist)
if isempty(get(figlist(i),'Name'))
defaultfilenames(i) = mat2cell(['filename' num2str(i)]);

Then, all you have to do is use 'defaultfilenames' for the field that displays the default filename, and also convert the string from cell to mat, just before actual saving the file (because fullfile function cannot handle cell elements).

I can post the modified file if you are interested.


Nicolas Beuchat

The bug is now corrected, my apologies for the delay!

Nicolas Beuchat

Apparently the last submission was not correct too. While waiting for the corrected version, you can change the problematic lines which are lines 360 and 362 as:


should be replaced by


My apologies for these issues.

Nicolas Beuchat

Actually, the last version (2/24/12) has another huge bug which make all the figures to be saved as the last figure... Please, wait for the new submission to be approved!

Nicolas Beuchat

The last version (2/24/12) included a little bug. An error appear in the command prompt after successful saving. This bug does not affect the saving and a correction has just been submitted!
Sorry about that!


Very helpful, thank you Nicolas!


MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: yliu-xjtu/savemultifigs

Community Treasure Hunt

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

Start Hunting!