www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@DCTManager/guiCheckPoolStatus.m
function ret = guiCheckPoolStatus(obj) %GUICHECKPOOLSTATUS Check parpool status and display alert to user % % GUICHECKPOOLSTATUS(OBJ) checks whether the parpool command may prevent % jobs from executing on the current scheduler. If parpool is open the % dialog lets the user choose whether to close parpool and continue or % cancel the use of the scheduler. If the user wants to continue, a true % value is returned, otherwise the return is false. % Copyright 2007-2013 The MathWorks, Inc. isopen = mbcfoundation.DCTManager.isParpoolOpen('nocreate'); if isopen % The pool is open on this scheduler. Tell the user and let them % decide what to do msg = {['The parpool is open. You must close the parallel pool to continue ', ... 'running the optimization in parallel.'], ... '', ... 'Do you want to close the parallel pool and continue with creating the distributed job?'}; answer = questdlg(msg, 'Parallel Job Warning', 'Close Pool and Continue', 'Cancel', 'Cancel'); isopen = strcmpi(answer, 'Close Pool and Continue'); if isopen delete(gcp) ret = true; else ret = false; end else ret = true; end