www.gusucode.com > matlabxl 工具箱 matlab 源码程序 > matlabxl/removeFileFromExcelProject.m

    function removeFileFromExcelProject(filename)
% removeFileFromExcelProject removes the specified file from the current
% Deploytool project
%
%   removeFileFromExcelProject is a utility for MATLAB Builder EX. This utility 
%   removes the specified file from the project that is currently opened in 
%   Deploytool. it requires that the current Deploytool project is for Excel
%   Add-in target. Since only one class is allowed in an Excel Add-in project,
%   the file will be removed from that class. 
%   
%
%
%   SYNTAX:
%       removeFileFromExcelProject(filename)
%
%   USAGE:
%       removeFileFromExcelProject(filename)
%           Removes the specified file from the current Deploytool project
%
%
%
% 
%
% Copyright 2010-2013, The MathWorks, Inc.
%

[pathstr,name,ext] = fileparts(filename);

filename = [name, ext];
if( isempty(pathstr) )
    filename=which(filename);
else
    filename = fullfile(pathstr,filename);   	
end

fws=com.mathworks.toolbox.compiler.services.FunctionWizardService.getInstance();
fws.removeExportedFunction(filename);
if(fws.getNumberOfClasses()>0)
    fws.removeMethodFromClass(fws.getClassName(),filename);
end
end