Borrar filtros
Borrar filtros

Is it possible to use IF statement in parfor?

11 visualizaciones (últimos 30 días)
Burak Alakus
Burak Alakus el 25 de Dic. de 2018
Respondida: Walter Roberson el 25 de Dic. de 2018
Hello guys. I tried to use if statemen in parfor loop yet there is no response.
Here is my code;
parfor i=1:32
if i==1
V11S02Fp1 = V11S02(1,i,:)
elseif i==2
V11S02AF3 = V11S02(1,i,:)
end
end
It really works with for statement however there is no response on parfor. Where is the problem?

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Dic. de 2018
if is valid in parfor. However, each iteration must write into a portion of the same variable. It is not possible to assign to different variables from different iterations and have the result be brought out of the parfor: anything that is not input and is not indexed by the parfor index will be considered to be a local variable for the purposes of the iteration.

Más respuestas (0)

Categorías

Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by