Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Error in classifying variable in parallel for loop.

1 visualizzazione (ultimi 30 giorni)
Sara
Sara il 6 Giu 2014
Chiuso: MATLAB Answer Bot il 20 Ago 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

Risposte (1)

Tejas M U
Tejas M U il 16 Giu 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.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by