1 | function 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 |
|
---|
31 | if nargin==1
|
---|
32 | [pathstr, name, ext] = fileparts(filenamein);
|
---|
33 | filenameout = [name '_new.fig'];
|
---|
34 | end
|
---|
35 |
|
---|
36 | v=load(filenamein,'-mat');
|
---|
37 | hgS_070000=v.hgS_070000;
|
---|
38 | c=hgS_070000.children;
|
---|
39 | count = 0;
|
---|
40 | for 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
|
---|
47 | end
|
---|
48 | c(ix)=[];
|
---|
49 | hgS_070000.children=c;
|
---|
50 | hgS_070000.properties.CreateFcn = '';
|
---|
51 | save(filenameout,'hgS_070000');
|
---|
52 |
|
---|
53 |
|
---|