For loop problem involving switching numbers in a vector..
이전 댓글 표시
I need help switching numbers in a vector in a for loop. x = [1 -2 3 5 4 2]; Compare the 1st and 2nd entries in x. Swap the two entries if the first entry is larger than the second. then do 2nd and 3rd. 3rd and 4th. 4th and 5th. 5th and 6th. then i will need to output the correct final vector.
댓글 수: 1
Walter Roberson
2015년 10월 8일
Please be more specific about the parts you are having difficulty with. Are you able to write "for loops"? Are you familiar with "if" ? Are you able to index values?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!