PARFOR error not enough input arguments
7 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 23 Dec 2012
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.
Accepted Answer
Matt J
on 23 Dec 2012
Does the problem presist if you close, then re-open matlabpool? Maybe it was just a temporary system problem.
0 Comments
More Answers (2)
Image Analyst
on 23 Dec 2012
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 Comments
Matt J
on 23 Dec 2012
Edited: Matt J
on 23 Dec 2012
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.
Image Analyst
on 23 Dec 2012
Thanks for the clarification. I don't have that toolbox so I didn't know.
See Also
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!