フィルターのクリア

Numel error cant figure out why

1 回表示 (過去 30 日間)
Anantha Padmanabhan
Anantha Padmanabhan 2014 年 10 月 13 日
回答済み: Roger Stafford 2014 年 10 月 14 日
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

回答 (1 件)

Roger Stafford
Roger Stafford 2014 年 10 月 14 日
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.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by