www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevproject/loadMBCProject.m

    function [MP, msg] = loadMBCProject(MP, filename)
%LOADMBCPROJECT
% 
%  [MP, MSG] = loadMBCProject(MP, FILENAME)

%  Copyright 2000-2014 The MathWorks, Inc. and Ford Global Technologies, Inc.


% Really want to ensure that filename is a fully qualified path
filename = i_ensureFullyQualifiedPath(filename);
oldFilename = MP.Filename;

% Let's try and get a lock on the file we want to open
[newMP,msg] = load(MP,filename);

if isempty(msg)
    % Make sure that the previously loaded file is unregistered
    UnregisterFile(MP, oldFilename);
    % Delete the previous project
    delete(MP);
    MP = newMP;
end

% ------------------------------------------------------------------------------
%
% ------------------------------------------------------------------------------
function filename = i_ensureFullyQualifiedPath(filename)
% Break into constituents
[path, file, ext] = fileparts(filename);
% Has it got a sensible path
if isempty(path)
    filename = [pwd filesep file ext];
end