Transparency violation
Ältere Kommentare anzeigen
Hi,
I have this code segment within a parfor ... end loop. Error flagged off, complaining about the way LT is used, so the code would not run.
% I have 8 workers
matlabpool open local 8
parfor n=1:100
.
. % other codes here
.
yt = UT + round ((Long(n)/15)*60);
for i=1:1440
if yt(i) <= 1440;
LT(i) = yt(i);
elseif yt(i) > 1440
LT(i) = yt(i)-1440;
end;
end;
.
. % other codes here too
.
end % parfor end
matlabpool close
I read some helpful note, transparency error and variable classification error were referred to, but could still not resolve the problem.
So, I may need to slice the variable LT or so. Kindly help to fix this code.
Felix
Akzeptierte Antwort
Weitere Antworten (1)
Edric Ellis
am 16 Jan. 2012
You're not indexing 'LT' with the loop variable, so it can never be 'sliced'. Are you calculating the whole of 'LT' each time around your main PARFOR loop? If so, it might help to pre-allocate it so that PARFOR knows you're not trying to use it in an order-dependent way. Something like
parfor n = 1:100
LT = zeros(1,1440);
for i = 1:1440
% do stuff
end
end
1 Kommentar
Facosoft
am 16 Jan. 2012
Kategorien
Mehr zu Surrogate Optimization finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!