note that these are just example arrays, im trying to write a code that i can use for different angle conditions, but I know how to do that portion im pretty sure.
Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
If elements one array meet condition, use data in same element position in second array
조회 수: 2 (최근 30일)
이전 댓글 표시
Lets say I have an array of bearing angles such as: [0, 90, 0] and I want to use elements a that are equal to zero. I then want to use the data in another array of displacments [10, 10, 20], that are in the same positions as the angles that meet the condition in the first array. Im not sure how to do this, I figured out how to use the displacment and angle to then find x and y coordinates Im just not sure how to do this.
댓글 수: 1
답변 (1개)
Ameer Hamza
2020년 11월 14일
편집: Ameer Hamza
2020년 11월 14일
Read about logical indexing: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html
a = [0, 90, 0];
b = [10, 10, 20];
y = b(a==0)
Result
>> y
y =
10 20
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!