필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Error in classifying variable in parallel for loop.

조회 수: 1 (최근 30일)
Sara
Sara 2014년 6월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (1개)

Tejas M U
Tejas M U 2014년 6월 16일
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.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by