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

    function appdesigner(inputFileNameOrPath)
% APPDESIGNER  Open App Designer.
%
% APPDESIGNER opens App Designer and creates a new app with the default
% name, App1.
%
% APPDESIGNER(filespec) opens App Designer and the file specified by
% 'filespec'. The 'filespec' must be the full path to the file, or a
% partial path or file name on the MATLAB search path.
%
% If App Designer is already open, all variations of the appdesigner
% syntax make App Designer visible and raise it on the screen.
%
% If a specified file is already open, the tab of the specified app
% gets focus.

% Copyright 2014 - 2015 The MathWorks, Inc.

filePath = '';
fileExt = '.mlapp';
if (nargin == 1)
    if ~ischar(inputFileNameOrPath)
        error(message('MATLAB:appdesigner:appdesigner:InvalidInput'));
    end
    [filePath, file, ext] = fileparts(inputFileNameOrPath);
    
    if iskeyword(file)
        error(message('MATLAB:appdesigner:appdesigner:FileNameFailsIsKeyword'));
    end
    
    if ~isvarname(file)
        error(message('MATLAB:appdesigner:appdesigner:FileNameFailsIsVarName', file));
    end
    
    % Append the default file extension if necessary.
    if isempty(ext)
        ext = fileExt;
    elseif ~strcmp(ext, fileExt)
        error(message('MATLAB:appdesigner:appdesigner:InvalidFileExtension', inputFileNameOrPath));
    end
    
    % Get the file path with the correct extension.
    filePath = fullfile(filePath, [file ext]);
    
    if ~exist(filePath, 'file')
        error(message('MATLAB:appdesigner:appdesigner:InvalidFileName', filePath));
    end
    
    % Get the full file path of the app.
    [success, fileInfo, ~] = fileattrib(filePath);
    if success
        filePath = appdesigner.internal.application.normalizeFullFileName(fileInfo.Name);
    else
        % which only works for the file in the MATLAB search path, and also
        % return the normalized file path
        filePath = which(filePath);
    end
    
end

% Launch App Designer
appdesigner.internal.application.getAppDesignEnvironment().startAppDesigner(filePath);
end