Programme is not giving any output
Info
This question is closed. Reopen it to edit or answer.
Show older comments
for i=1:size(X,1)
t1=abs(centroids(1,1)-X(i,1));
t2=abs(centroids(2,1)-X(i,1));
T(i,:)=[t1 t2];
MINM(i,1)=min(T(i,:));
if MINM(i,1)==T(i,1)
Sample(i,1)=1;
else
Sample(i,1)=2;
end
end
Location=find(Sample==1);
this programme is not giving any output and even errors also.. up to 1hr also it is not giving any output.
Kindly help me to resolve this.
2 Comments
madhan ravi
on 19 Feb 2019
How do you expect the third person to run the code without any datas?
Walter Roberson
on 19 Feb 2019
try pressing control C. I suspect it might be expecting you to type something .
Answers (1)
KSSV
on 19 Feb 2019
I suspect, you are using == on flottants...try the below code.
tol = 10^-6 ;
for i=1:size(X,1)
t1=abs(centroids(1,1)-X(i,1));
t2=abs(centroids(2,1)-X(i,1));
T(i,:)=[t1 t2];
MINM(i,1)=min(T(i,:));
if abs(MINM(i,1)-T(i,1))<=tol
Sample(i,1)=1;
else
Sample(i,1)=2;
end
end
Location=find(Sample==1);
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!