source: MML/trunk/machine/SOLEIL/common/toolbox/ezyfit/ezyfit/remove_efmenu_fig.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.6 KB
Line 
1function remove_efmenu_fig(filenamein,filenameout)
2%REMOVE_EFMENU_FIG   Remove the Ezyfit menu from figure files (.FIG)
3%   REMOVE_EFMENU_FIG(FILENAMEIN,FILENAMEOUT) removes the Ezyfit menu from
4%   the figure file FILENAMEIN, and saves the result under FILENAMEOUT.
5%
6%   REMOVE_EFMENU_FIG(FILENAMEIN) automatically generates the output
7%   filename, by adding the string '_new' to the input filename.
8%
9%   This function fixes the issue of figure files including the Ezyfit menu
10%   opened in a Matlab system running without the Ezyfit toolbox. See
11%   EFMENU for details.
12%
13%   Example:
14%     plotsample;   % generate a random plot
15%     saveas(gcf,'myfig.fig');
16%     remove_efmenu_fig('myfig.fig');
17%     % This generates a new file, named 'myfig_new.fig', without the menu
18%
19%   Acknowledgments to Francis Burton and Nicholas Sinclair, who fixed
20%   the issue in the Matlab Central Newsgroup.
21%
22%   See also EFMENU.
23
24%   F. Moisy, moisy_at_fast.u-psud.fr
25%   Revision: 1.00,  Date: 2010/07/05
26%   This function is part of the EzyFit Toolbox
27
28% History:
29% 2010/07/05: v1.00, first version, from nicholas.sinclair@gmail.com
30
31if nargin==1
32    [pathstr, name, ext] = fileparts(filenamein);
33    filenameout = [name '_new.fig'];
34end
35
36v=load(filenamein,'-mat');
37hgS_070000=v.hgS_070000;
38c=hgS_070000.children;
39count = 0;
40for i = 1:length(c)
41    if isfield(c(i).properties,'Label')
42        if(strfind(c(i).properties.Label,'EzyFit'))
43            count = count+1;
44            ix(count) = i;
45        end
46    end
47end
48c(ix)=[];
49hgS_070000.children=c;
50hgS_070000.properties.CreateFcn = '';
51save(filenameout,'hgS_070000');
52
53
Note: See TracBrowser for help on using the repository browser.