Batch command on parallel pool with single cell array input argument
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Job and Task Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!