A row matrix B=[21 43 23 65]. Now I want to sort them in ascending order and also want the order of their location. How to do this??? I want the output file look like: [21 23 43 65] and [1 3 2 4].

 채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 27일

0 개 추천

[sorted, order] = sort(B)

댓글 수: 1

PARTHA HALDAR
PARTHA HALDAR 2015년 11월 27일
for B=[21 43 23 65] i have the outfile as reported but if B=[21 43 21 65] then two answers should come one is [1 3 2 4] and another one is [3 1 2 4]. This is not coming...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

질문:

2015년 11월 27일

댓글:

2015년 11월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by