Batch command on parallel pool with single cell array input argument
Mostrar comentarios más antiguos
I want to run a function on a worker in a parallel pool. I use the batch command for that. Let's say I have the function
function out = some_function(in)
for i = 1:numel(in)
out{i} = 2*in{i};
end
Now, I want to run this function on a worker. I read the documentation on the batch command and it says to do the following
job = batch(@some_function, 1, { {1, 2, 3} });
However, when I run this command, the job shows the error
"Too many input arguments"
If I instead change the example function to
function out = some_function2(in, in2)
for i = 1:numel(in)
out{i} = 2*in{i};
end
and run
job = batch(@some_function2, 1, { {1, 2, 3}, [] });
it works correctly.
Why does the first example not work and how can I make it accept the single cell array as input? I expect the problem to be with the nested cell array, but I don't understand why.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Job and Task Creation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!