How to Classify the Variable for parfor program?
Show older comments
Hi Everybody,
I am priya Now doing one research. I want execute my code parallel using parfor. But not able to Run It. I got a Error Msg. ??? Error: The variable mcode in a parfor cannot be classified. See Parallel for Loops in MATLAB, "Overview".
This is my sample code
parfor i1=1:1:n
disp(i1);
??? Error: The variable mcoder,mcodeg,mcodeb,a,e,gcoder,gcodeg,gcodeb in a parfor cannot be classified.
See Parallel for Loops in MATLAB, "Overview".
if (var(i1) < 25)
label(i1)=0;
mcoder(e)=mranr(i1);
mcodeg(e)=mrang(i1);
mcodeb(e)=mranb(i1);
mgacode=cat(3,mcoder,mcodeg,mcodeb);
e=e+1;
else
label(i1)=1;
[a b c d er]=rand1(value1r(i1,:),value2,value3,value4);
[a b c d eg]=rand1(value1g(i1,:),value2,value3,value4);
[a b c d eb]=rand1(value1b(i1,:),value2,value3,value4);
??? Error using ==>
parallel_function at 598
Error in ==>
parallel_function>make_general_channel/channel_general
at 872
Subscripted assignment
dimension mismatch.
% following code mismatch error
gcoder(a,:) = [a b c d er];
gcodeg(a,:) = [a b c d eg];
gcodeb(a,:) = [a b c d eb];
gcode=cat(3,gcoder,gcodeg,gcodeb);
a=a+1;
err=(er+eg+eb)/3;
if (err > llim)
eno=eno+1;
end
end
end
My code Run properly without parfor. But With Parfor I got so many error msg.
I am a new matlab user. How can I modify that code please any one help me my problem.
Thank You so much.
Accepted Answer
More Answers (0)
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!