If elements one array meet condition, use data in same element position in second array
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
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 件のコメント
That Guy
2020 年 11 月 14 日
回答 (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!