Sort Matlab table based on pre-defined order
51 次查看(过去 30 天)
显示 更早的评论
I would like to sort a table based on a column that only contains 4 string values (A, B, C, and d) in an specific order that is not alphabetic.
This is what I am currently using:
sortrows(table_1,{'col1','col2'},{'ascend' 'descend'})
For col2 I would like to use a custom order that is neither ascend nor descend. So for instance the sorting order should be:
B
A
C
D
0 个评论
采纳的回答
更多回答(1 个)
另请参阅
类别
在 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!