Sort array based on particular rows
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I have 33 x 2 array, here I need to re arrange the values in descending order based on values in the first colum. I know that I can use 'sort' function for this.
However here the challenge is I need to re arrange first 6 rows and next 5 rows, then next 6 rows and then next 5 rows like this until 33 rows. Could some one please help with this?
采纳的回答
更多回答(1 个)
Voss
2025-2-12
out = load('matlab.mat').out
C = mat2cell(out,[6 5 6 5 6 5]);
C = cellfun(@(x)sortrows(x,1,'descend'),C,'UniformOutput',false);
out = vertcat(C{:})
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!