Sort() function return wrong values
3 次查看(过去 30 天)
显示 更早的评论
I have used this code to sort a 342x2 matrix using the second column as a reference to mantain the correspondence between rows:
[~, s] = sort(minCell(:,2));
minCell(s, :);
The problem is that the result is not correct. Second column has values between 1 and 9000 and it seems it doesn't work well with numbers <100
Anyone of you know how I can fix this problem?
Thanks
0 个评论
采纳的回答
Stephen23
2020-10-15
You are not assigning the sorted matrix to anything. You need to assign it to a variable, e.g.:
minCell = minCell(s, :);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!