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

    function s = openDeploytoolProject(origFilename)
% opens an excel AddIn project in deploytool
%
%   openDeploytoolProject is a utility for MATLAB Builder EX. It needs a full file path. This utility 
%   opens the specified project file in Deploytool. If the project file is
%   not an excel AddIn, a message will be displayed notifying the user.
%   
%
%
%   SYNTAX:
%       openDeploytoolProject(filename)
%
%   USAGE:
%       openDeploytoolProject(filename)
%           Opens the specified Excel AddIn project
%
%
% 
%
% Copyright 2010-2013, The MathWorks, Inc.
%

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

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

if (isempty(filename))
   error(message('MATLAB:open:fileNotFound',origFilename));
end

fws=com.mathworks.toolbox.compiler.services.FunctionWizardService.getInstance();

%now check if the project is the correct target type
isExcelAddin=fws.isExcelAddinProject(filename);
if(~isExcelAddin)
    %the project should not be opened
    error(message('matlabxl:functionwizard:openedWrongProject'));
    %s=false;
else
    %go ahead and open the project
   s=fws.openConfiguration(filename);  
end