Effacer les filtres
Effacer les filtres

Numel error cant figure out why

1 vue (au cours des 30 derniers jours)
Anantha Padmanabhan
Anantha Padmanabhan le 13 Oct 2014
for i=1:1:randomvariableforx1secondpoint
if actualshrtestdistancepoint2==distancepointfromotherpointsecondpoint(i)
pointtouse2haha=i;
break;
else ('hahaha no');
end
end
pointtouse2=pointtouse2haha;
% distancepointfromotherpointlel2=sqrt(((xlocation1secondpoint(pointtouse2)/10)-p2x)^2+((ylocation1secondpoint(pointtouse2)/10)-p2y)^2);
% distancepointfromotherpoint2=min(distancepointfromotherpointlel2)
%% newxlocationonsecondlinelel=xlocation1(pointtouse2)/10;
newylocationonsecondlinelel=ylocation1(pointtouse2)/10;
So my variable "randomvariableforx1secondpoint" is 48 and i find the maximum value at 37. so i wanted to use this position of i but for some reason my code uses the value of 48 in the foollowing steps and i get a numel error. can you guys help out? thanks

Réponses (1)

Roger Stafford
Roger Stafford le 14 Oct 2014
It looks as though the exact equality demanded by "==" never occurred and so the 'break' did not happen, but your value of 'pointtouse2haha' had previously been set to 48 before the for-loop. Remember, "==" requires precise equality, not just equality within some given tolerance.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by