フィルターのクリア

Problem Code Matlab [Beginner]

2 ビュー (過去 30 日間)
Alex castilla
Alex castilla 2018 年 3 月 21 日
編集済み: Alex castilla 2018 年 3 月 21 日
Hello everybody, I have a small question:
I have two matrices: A(2099x2) and B(9x4).
Matrix A = trajectory (x,y coordinates)
Matrix B = X,Y coordinates of 9 targets (black square dots), the width=0.20 and the height= 0.20.
I would like to know if the trajectory (blue line) passes through the green area (green square) around the black square. I'm working on a code but It doesn’t seem to work, any suggestions?:
reach_target= zeros(9,1);
for i = 1:length(X)
if ((x > X(i)) - (w/2)) & ((x < X(i)) + (w/2))
if ((y > Y(i)) - (h/2)) & ((y < Y(i)) + (h/2))
reach_target(i)=1;
end
end
end
Thanks very much!

回答 (0 件)

カテゴリ

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