function myApp(n, nslots)
% Sample user application
% Purpose: Computes Arithmetic Sequence Sum  s = 1+2+3+ . . . +n

% Compute sum with Parallel Computing Toolbox's parfor
matlabpool('local', nslots);  % use only as many cores as requested
s = 0;    % initialize solution
parfor i=1:n
    s = s + i;       % s = 1 + 2 + 3 + . . . + n
end
matlabpool close;  % return cores

end   % end of function

