SAME VALUE ON EVERY LOOP...
조회 수: 11 (최근 30일)
이전 댓글 표시
HI EVERYONE. need some help here...
my code is giving me the same output on every run and no matter what im doing, its giving me the same output.
here is a snippet of whats going on.
data = 2;
point = [1 2 3 ;
4 7 8 ; ]; %% for point clouf.
ptcloud = pointCloud(centroidlocation);
radius = 15;
lesion = 5;
for p =1: data
temp_point = point(p,:);
% Get the indices and the distances of points that lie within the specified radius
[indices,dists] = findNeighborsInRadius(ptcloud,temp_point,radius);
ptcloudB = select(ptcloud,indices);
indices_1 = length(indices);
% change material properties of lesion
for i=1:indices_1
t_id = elem_e(:);
t_id(indices)= lesion;
end
% do whatever for point
% multiple loops to find stuff
file_name (p) = min (whatever);
file_name_2(p) = min (whatever2);
file_name_3 (p) = min (whatever3)
end
help please!!!!
댓글 수: 3
VBBV
2020년 10월 2일
%if true
% code
% end
% change material properties of lesion
for i=1:indices_1
t_id = elem_e(:);
t_id(i)= lesion;
end
Try the loop index in t_id.
답변 (1개)
Steve Eddins
2020년 10월 2일
This loop in your code looks suspicious to me:
% change material properties of lesion
for i=1:indices_1
t_id = elem_e(:);
t_id(indices)= lesion;
end
Perhaps I am misunderstanding something, but it looks like t_id will be unchanged after the first iteration through the loop body. Is there a programming error here?
If you haven't done this already, then I recommend that you try using the debugger. Set a breakpoint at the beginning of the code, then execute it. Single-step through each line of the code, pausing to inspect the values of variables that just got changed. See if the values are what you expect. In case you are not familiar with the debugger, here is a documentation link.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!