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

    function MP = UnregisterFile(MP, filename)
%UNREGISTERFILE Unlock a project file
%
%  P = UNREGISTERFILE(P, FILE) deletes the lock file that is associated
%  with the open project P.

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


if nargin < 2
    filename = MP.Filename;
end

% Get the path to the current file
[P, F] = fileparts(filename);

% Create temporary filename
tmpFilename = [P filesep '~' F '_xreg.tmp'];

% Check that the temp file exists (not sure why the path cannot be empty -
% doesn't seem to be unreasonable to have an empty path)
if ~isempty(P) && exist(tmpFilename, 'file')
    try
        delete(tmpFilename);
    catch
        warning(message('mbc:mbcproject:UnknownError', tmpFilename));
    end
end