sorting and unsorting ?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhammad
am 14 Sep. 2021
Beantwortet: Image Analyst
am 14 Sep. 2021
clc
clear all
a=magic(3)
[b,ind]=sort(a,1,'descend')
c(ind)=b;
i sorted the matrix but i want back the orignal matix a how i can do it
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 14 Sep. 2021
Try this:
a = magic(3)
[b, sortOrder] = sort(a, 1, 'descend')
c = zeros(size(b));
for col = 1 : size(b, 2)
c(:, col) = b(sortOrder(:, col), col);
end
c
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!