%% PRIME_SCRIPT is a script to call PRIME_FUN_PARFOR.
%
%  Discussion:
%
%    The BATCH command runs scripts, not functions.  So we have to write
%    this short script if we want to work with BATCH!
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'PRIME_SCRIPT\n' );
  fprintf ( 1, '  Count prime numbers from 1 to %d\n', n );

  matlabpool ( 'open', 'local', 4 )

  n = 50;

  while ( n <= 500000 )
    primes = prime_fun_parfor ( n );
    fprintf ( 1, '  %8d  %8d\\n', n, primes );
    n = n * 10;
  end

  matlabpool ( 'close' )
