MATLAB Answers

Parfor --> Undefined function 'colon' for input arguments of type 'distributed'.

8 views (last 30 days)
Maria
Maria on 13 Aug 2021
Answered: Maria on 19 Aug 2021
Hi,
I am new with the parallel toolbox and I need some help. I have a code that looks like this
function A = main_function(..)
parfor c1=1:m
for c2=1:n
if c2 >= c1
A(c1,c2,:)= my_function(..);
end
end
end
end
I get an error that says
Error using internal_compute_H_9int_vect_simplified (line 141). The source code (C:\Users\..\main_function.m) for the parfor-loop that is trying to execute on the worker could not be found.
Caused by:
Undefined function 'colon' for input arguments of type 'distributed'.
Error using remoteParallelFunction (line 84)
Worker unable to find file.
Undefined function 'colon' for input arguments of type 'distributed'.
At first I thought that the problem was the ":" in the matrix A, but then I tried this simple code
m = 3;
n = 3;
H = zeros(2,2,3);
beta =rand(3,1);
parfor c1=1:m
for c2=1:n
H(c1,c2,:) = 3*rand(3,1);
end
end
and it works.
What is the problem? Is related to the location of the function "main_function", to the matrix A , or to what I do in the funtion "my_function" ? What "distributed" actually means here?
Best
  3 Comments
Maria
Maria on 19 Aug 2021
Maybe it can help, I already tested "my_function" in a different (parallelized) code and it did not give any error. This is why I am a bit confused.

Sign in to comment.

Accepted Answer

Maria
Maria on 19 Aug 2021
So, I had a problem in my code, that is now fixed. I had another function, which I forgot to test, and where I was using distributed arrays. I removed the 'distributed' and now it works! Strange that the error did not point exactly at that function...but now it works!

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by