www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgproject/close.m

    function [PROJ,msg] = close(PROJ,force,LastNode)
%CLOSE Close a project
%
%  [PROJ,MSG] = CLOSE(PROJ,FORCEFLG,LASTNODE) 

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


if nargin<2
    force= 0;
end
if nargin<3
    LastNode = [];
end
msg='';
% mbctraining file
[p,filenm,~] = fileparts(projectfile(PROJ));

if force
    [PROJ,msg]= save(PROJ,0);
elseif PROJ.modified % needs saving
    if ~(isnewproject(PROJ) || strcmp(p,fullfile(mbcpath,'mbctraining')))
        answer =questdlg(['Do you want to save the changes you made to "',filenm,'"?'], ...
            'Save Project','Yes');
        drawnow
        switch answer
            case 'Yes'
                [PROJ,msg]= save(PROJ,0,LastNode);
                pointer(PROJ);
            case {'Cancel', ''}
                msg= 'File not saved';
                return
        end
    end
end

% delete temp file
PROJ = unregisterfile(PROJ);