% You can use this script to test whether parallelization
% works on your computer!
% NEEDS: Parallel Computing Toolbox

foo = @(x) pause(x); % test function

% Sequential computation
% Try doing four 1 second computations sequentially
tic;
for k = 1:4
    foo(1);
end
time = toc;
disp(['Sequential time: ',num2str(time),' sec']);

% Parallelized computation
% Try distributing 1 second computation tasks
% to multiple CPUs

% Initialize parallel pool
poolobj = gcp('nocreate');
if isempty(poolobj)
    parpool;
end

tic;
parfor k = 1:4
    foo(1);
end
time = toc;
disp(['Parallel time: ',num2str(time),' sec']);