sorting and unsorting ?
4 views (last 30 days)
Show older comments
Muhammad on 14 Sep 2021
Answered: Image Analyst on 14 Sep 2021
i sorted the matrix but i want back the orignal matix a how i can do it
Image Analyst on 14 Sep 2021
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);
More Answers (0)
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!