I have the following code and get indexing error
parfor dt=0:round(tmax/step)
fprintf(1,'\b\b\b\b\b%05.2f',dt);
for dm=0:dt
A(dm+1,dt+1) = f(dm,dt);
end
end
It does not make sense, for me, because each loop of the first for is stand alone in the variable dt. The size of A has been prefixed.
The error messages on the script are:
-The PARFOOR loop cannot run due to the way varaiable 'A' is used. (On line 1)
-Valid indices for 'A' are resticted in PARFOR loops. (On line 4)
Error when run:
Error: The variable A in a parfor cannot be classified. See Parallel for Loops in MATLAB, "Overview".
4 Comments
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609856
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609856
What is f ? And how big is it?
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609866
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609866
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609873
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_609873
@Andreu Angles Castillo: please give the complete error message. This means all of the red text.
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_610393
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/418841-how-to-fix-index-in-a-parfoor-loop#comment_610393
Sign in to comment.