How do i do this:
before:
a=[3 9 5 7;
3 0 1 2;
11 2 0 9];
after:
a=[11 9 9 7;
5 3 3 2;
2 1 0 0;]

답변 (1개)

Stephan
Stephan 2018년 12월 1일
편집: Stephan 2018년 12월 1일

0 개 추천

Hi,
try:
>> a = [3 9 5 7; 3 0 1 2; 11 2 0 9]
a =
3 9 5 7
3 0 1 2
11 2 0 9
>> b = reshape(fliplr(sort(reshape(a,1,[]))),4,3)'
b =
11 9 9 7
5 3 3 2
2 1 0 0
Best regards
Stephan

카테고리

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

태그

질문:

2018년 12월 1일

편집:

2018년 12월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by