Parallel Producer-Consumer for MATLABPOOL
19 Feb 2010
Provides a simple interface to the MATLABPOOL with functionality similar to PCT PARALLEL_FUNCTION.
% [nlabs, isPCTInstalled] = parGetNumLabs
% get number of labs running
function [nlabs, isPCTInstalled] = parGetNumLabs
% is the Parallel Computing Toolbox installed?
% this shouldn't change during a Matlab session, so just check once
PCT_INSTALLED = logical(exist('com.mathworks.toolbox.distcomp.pmode.SessionFactory', 'class'));
isPCTInstalled = PCT_INSTALLED;
% if its running, how many labs are there?
nlabs = matlabpool('size');
nlabs = 0;