Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
The variable in parfor cant classified
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello.This is my code:
c_hat = zeros(n,1);
vc = zeros(m,n);
cv = zeros(m,n);
parfor j = 1:n
checks = find(H(:,j));
allIncoming = cv(checks,j);
sumAllIncoming = sum(allIncoming) + LLRs(j);
c_hat(j) = (1 - sign(sumAllIncoming))/2;
toCheck = sumAllIncoming - allIncoming;
vc(checks,j) = toCheck;
end
It is not runing because "The variable vc in a parfor cannot be classified." Without parfor it is running fine. Is it possible to run it with parfor?
0 Commenti
Risposte (1)
Matt J
il 4 Lug 2013
Modificato: Matt J
il 4 Lug 2013
There are rules about sliced variables and how you can index them in parfor loops. However, you can get around these rules by re-organizing vc and cv as cell arrays,
c_hat = zeros(n,1);
vc = num2cell(zeros(m,n),1);
cv = vc;
parfor j = 1:n
checks = H(:,j)~=0;
allIncoming = cv{j}(checks);
sumAllIncoming = sum(allIncoming) + LLRs(j);
c_hat(j) = (1 - sign(sumAllIncoming))/2;
toCheck = sumAllIncoming - allIncoming;
vc{j}(checks) = toCheck;
end
vc=[vc{:}]; %convert back to normal array
7 Commenti
Matt J
il 4 Lug 2013
Modificato: Matt J
il 4 Lug 2013
I take it back. Put this back
vc=[vc{:}];
but add immediately after it
vc=num2cell(vc,2);
Also, please learn to use DBSTOP to trap and investigate common errors like "Index exceeds matrix dimensions." and "Conversion to cell from double is not possible."
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!