Skip to content

Commit 10e3f01

Browse files
committed
Error with no parallel toolbox is resolved
1 parent 0fbcab0 commit 10e3f01

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/ProgressBar/ProgressBar.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
end
8585
properties (SetAccess = immutable, GetAccess = private, Transient)
8686
Listener = []
87+
no_parallel_toolbox
8788
end
8889
% ---------------------------- Properties -----------------------------
8990
properties (SetAccess = private, Transient)
@@ -134,6 +135,7 @@
134135
obj.N = N;
135136
obj.Queue = parallel.pool.DataQueue;
136137
obj.Listener = afterEach(obj.Queue, @(~) localIncrement(obj));
138+
obj.no_parallel_toolbox = ~license('test','parallel computing toolbox');
137139
obj.ui_type = ui;
138140

139141
switch obj.ui_type
@@ -154,10 +156,10 @@
154156
end
155157
% ---------------------------- Counter ----------------------------
156158
function count(obj)
157-
if isempty(getCurrentJob) % Serial processing
158-
obj.localIncrement(); % faster
159-
else % Parallel processing
160-
send(obj.Queue, true);
159+
if obj.no_parallel_toolbox || isempty(getCurrentJob)
160+
obj.localIncrement(); % Serial processing
161+
else
162+
send(obj.Queue, true); % Parallel processing
161163
end
162164
end
163165
end

0 commit comments

Comments
 (0)