File Exchange

image thumbnail

Save Multiple Figures in a click

version 1.10 (64 KB) by

Save multiple figures with a GUI in several formats. No need to save all figures one-by-one anymore!

4.74286
37 Ratings

67 Downloads

Updated

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).

Comments and Ratings (53)

Amin Khalaf

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

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

Hwang

Hwang (view profile)

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.

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

Stevan Jeknic

Doesn't work in 2015b.

Tom0610

Hi,

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?

Cheers,
Tom

J

J (view profile)

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

It was extremely helpful for me.

Quenton

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

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?

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

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');

Vivek

Vivek (view profile)

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
set(gcf,'name','data.log');
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.

Leon

Leon (view profile)

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)"

and

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

t3925

t3925 (view profile)

Nicholas,

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!

kammo

kammo (view profile)

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{:});
 

Roland

Roland (view profile)

Allen

Allen (view profile)

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

Igor

Igor (view profile)

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).

Cheers

Andre

Andre (view profile)

Works perfectly.

Bryan

Bryan (view profile)

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

ahmed

ahmed (view profile)

perfct tool

Sofie

Sofie (view profile)

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.

Justin

Justin (view profile)

Tom

Tom (view profile)

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

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

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

Nicolas Beuchat (view profile)

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:

set(gcf,'name','newfigurename')

Cheers!

Lucas

Lucas (view profile)

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

Nicolas Beuchat (view profile)

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.

Cheers,
Nicolas

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)
        feval(varargin{:});

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'

Could anyone help me?
Thanks a million.

b3824855

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

Alan

Alan (view profile)

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

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.

Jeff

Jeff (view profile)

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.

DimoneTHEone

Tassos

Tassos (view profile)

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

Nicolas Beuchat

Nicolas Beuchat (view profile)

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!

Tassos

Tassos (view profile)

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:

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

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.

Thanks

Nicolas Beuchat

Nicolas Beuchat (view profile)

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

Nicolas Beuchat

Nicolas Beuchat (view profile)

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:

saveas(handles.figlist(ind(n))

should be replaced by

saveas(handles.figlist(ind(i))

My apologies for these issues.

Nicolas Beuchat

Nicolas Beuchat (view profile)

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

Nicolas Beuchat (view profile)

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!

John

John (view profile)

Very helpful, thank you Nicolas!

Virginie

Updates

1.10

Default filename is now the name of the figure (if specified). Credits go to Tassos for this update.

1.7

Correction of the same bug that make the app to save all the figures as the last figure.

1.6

Correction of another bug introduced in the 2/24/12 version (all files were saved as the last figure).

1.5

Correction of a little bug that came out with the last version (24 Feb 2012) which displayed an error message after successful saving.

1.4

Check for figures having the same filename and rename them before saving.

1.3

Correction of the display of the number of files saved.

MATLAB Release
MATLAB 7.13 (R2011b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video