File size: 778 Bytes
5ab75a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function reply = hasParallelToolbox(S)
% Get availability of the Parallel Processing Toolbox:
%   R = hasParallelToolbox()
% Disable the flag for an existing PPT manually:
%   hasParallelToolbox(false)
% Re-enable the actual status:
%   hasParallelToolbox(true)   % Considers a missing toolbox also
% Set Variables as persistent (reduced overhead)
persistent hasPPT usePPT
if isempty(hasPPT)
    % Initialize variables
    hasPPT = false;
    usePPT = false;
    % Get Version Information
    VersionInfo = ver;
    for i=1:length(VersionInfo)
        if strcmpi(VersionInfo(i).Name,'Parallel Computing Toolbox')
            hasPPT = true;
        end
    end
  usePPT = hasPPT;
end
if nargin > 0
   usePPT = (any(S)) && hasPPT;
end
reply = usePPT;
end