PARFOR error not enough input arguments
6 次查看(过去 30 天)
显示 更早的评论
Hi, When I try a simple following code
> parfor i=1:2000
> j=i;
> end
I keep receiving this error:
> Error using parallel_function (line 589) Not enough input arguments.
I already ran > matlabpool open
Do you have any idea? Thanks!
2 个评论
Walter Roberson
2012-12-23
Try using different variable names, such as ii and jj. I'm wondering if the problem has to do with the fact that "i" and "j" are by default defined as functions.
采纳的回答
Matt J
2012-12-23
Does the problem presist if you close, then re-open matlabpool? Maybe it was just a temporary system problem.
0 个评论
更多回答(2 个)
Image Analyst
2012-12-23
Look to me that the problem is not what you said, especially since Matt J said that he has no problem with just that small snippet you supplied. Looking at your error message: " parallel_function (line 589)" it appears that you've drastically simplified the code. While that is good in most instances, it looks like you've unfortunately removed the actual part of the code that caused the problem. To me, it looks like down around line 589 of your program you attempted to call the code you posted. The code you posted was actually in a custom function your wrote called "parallel_function" and it took some arguments and you didn't supply all the necessary input arguments. A big clue was the message "Not enough input arguments." So you may have defined the function this way:
function [out1 out2] = parallel_function(in1, in2, in3)
but you called it like this at line 589 (didn't supply the in3 argument):
[main_out1, main_out2] = parallel_function(main_in1, main_in2); % Line 589
Is that the reason?
2 个评论
Matt J
2012-12-23
编辑:Matt J
2012-12-23
No, parallel_function is a stock function in the Parallel Computing Toolbox and somehow serves as the engine of PARFOR. Some internal problem had to have caused it to go haywire,
function varargout = parallel_function(range, F, consume, supply, ...
reduce, identity, concat, empty, ...
M, divide, next_divide)
%PARALLEL_FUNCTION
% This is the basis of parfor, but is not officially supported, either with
% this name or API.
% Copyright 1984-2009 The MathWorks, Inc.
% $Revision $ $Date: 2011/10/22 22:05:31 $
% The following is a help-style description of parallel_function.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!