www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@calibrationdata/@fileinterface/pUnlock.m

    function pUnlock(obj)
%PUNLOCK  Private method.

%  An interface obtains OS locks to referenced files and stores the
%  corresponding file identifiers in the Locks property.  This is to
%  prevent external processes from accessing the files while the interface
%  has a reference to the file.  Locks are released when files referenced
%  by the interface change or when the interface is deleted or goes out of
%  scope.

%  Copyright 2000-2005 The MathWorks, Inc.


for i = 1:numel(obj.Locks),
    % fclose in try-catch because it's possible to fclose all at the
    % command line; just do the best we can to lock the file
    try
        fclose(obj.Locks(i));
    end
end

obj.Locks = [];