Sort() function return wrong values
5 ビュー (過去 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!