1function resultCell = multicoredemo(multicoreDir)
2%MULTICOREDEMO  Test parallel processing on multiple cores.
3%   MULTICOREDEMO runs function testfun with 20 different parameters using
4%   function STARTMULTICOREMASTER. Open a second Matlab session on a
5%   multi-core machine and start function STARTMULTICORESLAVE to see the
6%   effect of the parallelization.
7%
8%   MULTICOREDEMO(DIRNAME) uses directory DIRNAME to put the intermediate
9%   files. Use this notation to test the parallelization of different
10%   machines that have access to a common directory.
11%
12%		Markus Buehren
13%		Last modified 13.11.2007
14%
15%   See also STARTMULTICOREMASTER, STARTMULTICORESLAVE.
16
17if nargin == 0
18	multicoreDir = '';
19end
20
21N = 20;
22maxMasterEvaluations = inf;
23
24parameterCell = cell(1,N);
25for k = 1:N
26	parameterCell{1,k} = k;
27end
28
29for k = 1:10
30	tic
31	resultCell = startmulticoremaster(@testfun, parameterCell, multicoreDir, maxMasterEvaluations);
32	toc
33end
34