www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@DCTManager/connect.m

    function [ok, errmsg] = connect(manager, ShowDialog)
%CONNECT Connect to the scheduler.
%
%   [OK, ERRMSG] = CONNECT(MANAGER, SHOWDIALOG) attempts to connect
%   to the scheduler defined by the current configuration.  The success
%   state and any resulting failure message are returned.  If SHOWDIALOG is
%   specified and is true, the failure messages are shown in a warning
%   dialog.

%   Copyright 2006-2010 The MathWorks, Inc.


% Clear any existing connection
manager.pClearScheduler;

% Make new connection
[ok, errmsg] = manager.pSetScheduler;
errmsg = sprintf(['An error occurred while connecting to the parallel ' ...
    'computing scheduler.  The error was:\n\n%s'], errmsg);

if ~ok && nargin>1 && ShowDialog
    h = warndlg(errmsg, 'Parallel Computing Toolbox Scheduler', 'modal');
    waitfor(h);
end