Info
この質問は閉じられています。 編集または回答するには再度開いてください。
For loop question help
1 回表示 (過去 30 日間)
古いコメントを表示
I have two vectors. A = [ 1 2 3 4 6] and x = [5 3 2 1]. For every value in x, I want to return the corresponding index value in A. For example, the first value of x is 5, so I want the loop to return A(5) =6. How could I do this?
0 件のコメント
回答 (1 件)
the cyclist
2020 年 3 月 5 日
You don't need a loop.
output = A(x);
gives you all the values at once. (Then you can loop over that if you need to)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!