Skip to content

Commit 98d84d3

Browse files
committed
is_parallel: simplify
1 parent c6cd0cc commit 98d84d3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

+stdlib/is_parallel_worker.m

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@
1414
%
1515
% ans = logical 1
1616

17-
function ispar = is_parallel_worker()
1817

19-
ispar = false;
18+
function ispar = is_parallel_worker()
2019

2120
try
22-
addons = matlab.addons.installedAddons();
21+
ispar = matlab.internal.parallel.isPCTInstalled() && ~isempty(getCurrentWorker());
2322
catch
24-
return
25-
end
26-
27-
if any(contains(addons.Name, 'Parallel Computing Toolbox'))
28-
ispar = ~isempty(getCurrentWorker());
23+
ispar = false;
2924
end
3025

3126
end

0 commit comments

Comments
 (0)