change the order of array
4 次查看(过去 30 天)
显示 更早的评论
I have M=[1,2 ;1,5; 2,4;2,5;4,5; 4,9;5,6;6,11;9,10;10,11] I want to change the order of numbers I want this answer N=[1,2;1,4;2,3;2,4;3,4;3,6;4,5;5,8;6,7;7,8]
采纳的回答
Bruno Luong
2018-10-22
[~,N] = ismember(M,unique(M(:)))
2 个评论
Bruno Luong
2018-10-22
I guess you mean 11 changes to 8 (not the opposite).
u = unique(M(:));
map = [u,(1:length(u)).']
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!