SAME VALUE ON EVERY LOOP...
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
VBBV
el 2 de Oct. de 2020
%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.
Respuestas (1)
Steve Eddins
el 2 de Oct. de 2020
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 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!