indexing problem in parfor

5 visualizaciones (últimos 30 días)
Rafael Schwarzenegger
Rafael Schwarzenegger el 11 de Oct. de 2019
Comentada: Rafael Schwarzenegger el 17 de Oct. de 2019
Even having code, which should run in parralel, Matlab writes: valid indeces for 'ndLog' are restricted in PARFOR loops.
Would anybody please know, what is the issue?
Thank you very much,
Rafael
al = [30 40 50]; m = [40 50 60];
tn=10; cm=cumsum(m); S=sum(m); r=[0 1];
ndLog=zeros(sum(m)*numel(r)*numel(al)*tn,5);
parfor a = 1:tn
for aa = 1:numel(al)
for k=1:numel(r)
for mm = 1:numel(m)
ind = -m(mm)+1+cm(mm) + (k-1)*S + (aa-1)*numel(r)*S +...
(a-1)*numel(al)*numel(r)*S;
ndLog(ind,:) = [a mm aa k 1];
end
end
end
end
  8 comentarios
Shivam Prasad
Shivam Prasad el 17 de Oct. de 2019
Editada: Shivam Prasad el 17 de Oct. de 2019
Hi Rafael,
Please refer to this link regarding variables in parfor loops:- https://www.mathworks.com/help/parallel-computing/troubleshoot-variables-in-parfor-loops.html
Rafael Schwarzenegger
Rafael Schwarzenegger el 17 de Oct. de 2019
Thank you for all the link. I was thinking, it was a type of a sliced variable. My index is pointing, which line of code are we going to fill with data. I have a multidimensional matri,x which I tranform into a 2D matrix. Then this index is the link between them. There is no repeared value, so therefore, I am a bit struggling, why Matlab doesn't want it. But thank you for your suggestions.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by