Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Error in classifying variable in parallel for loop.

1 visualización (últimos 30 días)
Sara
Sara el 6 de Jun. de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi! In the following code M1 is a 4d matrix. The error message I receive upon running this code is : The variable this_volume in a parfor cannot be classified. From what I understand I am just using the variable as a sliced input and output variable at the same time since I am assigning values to some of it's elements. I am not sure if the two extra for loops after the parfor are the cause of the problem. I will be grateful for any suggestions.
tic
fill_thresh = 12;
for a_fill = 1:size_M1(4)
this_volume = M1(:,:,:,a_fill);
this_volume_copy = this_volume;
parfor b_fill = 1:size_M1(3)
fill_factor = zeros(size_M1(1),size_M1(2));
for c_fill = 1+2:size_M1(1)-2
for d_fill = 1+2:size_M1(2)-2
fill_factor(c_fill,d_fill) = sum(sum(this_volume_copy(c_fill-2:c_fill+2,d_fill-2:d_fill+2,b_fill )));
if fill_factor(c_fill,d_fill ) > fill_thresh
this_volume(c_fill,d_fill,b_fill ) = 1;
end
end
end
toc
end
M1(:,:,:,a_fill) = this_volume;
toc
end

Respuestas (1)

Tejas M U
Tejas M U el 16 de Jun. de 2014
The reason for the error is documented as - “A parfor-loop generates an error if it contains any variables that cannot be uniquely categorized or if any variables violate their category restrictions.” in the link
Here is a link that might help you figure out how to sort this out.

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by