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!

