%% Create Single Task with All Cell Array Inputs
% Create a job object on the default cluster.

c = parcluster;
job = createJob(c);

% To create a single task with all cell arrays as its input arguments, use the {C1} syntax of createTask. For example, to create a task that runs strjoin({'1','1','2'},{'+','='}), use the following code.

task = createTask(job,@strjoin,1,{{{'1','1','2'},{'+','='}}});
task.InputArguments{:}

% Submit and wait for the job.

submit(job);
wait(job);

% Retrieve the outputs and display them.

outputs = fetchOutputs(job);
disp(outputs{1});

% If you attempt to use the {inputargs} syntax with {inputargs} = {{'1','1','2'},{'+','='}}, then createTask uses the {C1,...,Cm} syntax and creates multiple tasks. For example, the following code incorrectly creates two tasks, one for strjoin('1','1','2') and one for strjoin('+','=').
% task = createTask(job,@strjoin,1,{{'1','1','2'},{'+','='}});
% Copyright 2020 The MathWorks, Inc.